We are using the schedule controls to manage appointments for sales people. Our appointment entity has a number of fields in addition to those required by the schedule controls, including a customer and an appointment type (visit, phone call, etc). We map the subject in the schedule to a a subject field in the entity, in which the users can record a quick description of the appointment. The problem we have is that when looking at objects in the calendar, it's not clear from the subject who the appointment is with, and whether it is a visit or a phone call. I can more or less resolve this by mapping to a new composite field in the entity, that includes all three pieces of information. That would be okay, but it's still not ideal. For example, I'd like to indicate the appointment type using colour, shading or perhaps an icon. I'd quite like to have the customer and the subject on separate lines. So, is there a facility to override the rendering of the appointment in these views in a way that would allow me to do any of that?
Thanks,
Kevin
The reason for the description to show in my sample is because I have appointments duration set for an hour. If I set it to 15 minutes , the TimeSlots will be too small to show both Subject and Description and thus will have only the subject displayed. But at the same time you can easily show both the subject and the description by changing the font size which defines the Timeslot Height.
That being said, please run the initial sample by setting this.ultraDayView1.Appearance.FontData.SizeInPoints = 18; and you will see the difference.
Please modify the AfterCreateChildElements in the following manner to accommodate the Ofiice2007 style:
public void AfterCreateChildElements(Infragistics.Win.UIElement parent){ // If the parent is an EmbeddableUIElementBase, get the associated AppointmentUIElement // and remove all elements except for the EmbeddableUIElementBase, and change the bounds // of the EmbeddableUIElementBase to occupy the entire bounds of the AppointmentUIElement. EmbeddableUIElementBase embeddableElement = parent as EmbeddableUIElementBase; AppointmentUIElement appointmentElement = embeddableElement != null ? embeddableElement.GetAncestor( typeof(AppointmentUIElement) ) as AppointmentUIElement : null;if ( appointmentElement != null ) { // Get the associated appointment, and the text that should be displayed for it. Appointment appointment = appointmentElement.GetContext( typeof(Appointment) ) as Appointment; string text = this.GetAppointmentText( appointment );
// Set the bounds of the embeddable element embeddableElement.Rect = appointmentElement.RectInsideBorders;
// Get the embeddable element's TextUIElement TextUIElement textElement = embeddableElement.GetDescendant( typeof(TextUIElement) ) as TextUIElement; if ( textElement != null ) { // Change the text displayed by the embeddable element based on // the DisplayStyle. textElement.Text = text;
// Reverse iterate the AppointmentUIElement's ChildElements collection // and remove all elements except for the EmbeddableUIElementBase UIElementsCollection childElements = appointmentElement.ChildElements; int childElementCount = childElements.Count;
for ( int i = childElementCount - 1; i >= 0; i -- ) { UIElement element = childElements[i]; if ( element == embeddableElement ) continue;
childElements.Remove( element ); } } }}
I've taken a look at your sample, and it does seem to work okay, unless you set the ViewStyle to Office2007 - see this screencast: https://www.screencast.com/t/1ql73z2K - I've hardcoded the filter to show the subject and description. In office 2007 style, it seems to show the subject, followed by what looks like the start of the subject again, despite the control's text being set correctly when you look at it in the debugger. Unfortunately we are using the office2007 style throughout the application, and would prefer to keep using it here as well. Any thoughts? In fact, using the non-office2007 style the appointments show the description even without the filter, which I guess is why your original sample worked, but my code didn't
I've posted my revised version of the project here, if you'd like to take a look: https://www.dropbox.com/s/h6i3wy2ze2u7l5g/ultradayview_appointmenttext_cs.zip?dl=0
Thanks Joshee, I'll take a look. I'm a bit confused though, as the first sample you sent me did show the description, but there was no interface used to provide it?
Hi Kevin
There is no way to make the Description appear using the public object model.
One way to solve the problem is to use the IUIElementCreationFilter interface.I am attaching a sample where this has been implemented.
Just one small issue - on my controls the Description is not being displayed below the subject. I can't see where you've configured this in the sample code, nor can I see anything different in my configuration that would prevent it displaying - any ideas?