I'm able to use a custom IUIElementCreationFilter to edit the appointment text for regular appointment in dayview. However how do i change the appointment text for AllDayEvent appointment? I tried to set the TextUIElement text but that didn't work.
I remember searching and finding somewhere someone saying that there's a buffer length that's being set, but is there anyone to change that after the fact the appointment was created?
Your workaround is sound; I just want to mention that the fact that you need to do this is a bug that I believe has been fixed, so you might want to download the latest version of WinSchedule.
I figured it out. On the last couple of lines, I had to change the rect property of the TextUIElement to the size of the AllDayAppointment so that it would fit as much text as possible.
if (textElement != null){ textElement.Rect = allDayEventElement.Rect; textElement.Text = SetAllDayApptText(appointment);}
Thanks for the help!
I gave that a try and it didn't work..
Instead of displaying a clients name like: "John Doe", it would only display "J".
Is this a bug?
The following code sample demonstrates how to find and change the text of the TextUIElement that is used to render the AllDayEvent text:
public class AllDayEventCreationFiler : IUIElementCreationFilter{ #region IUIElementCreationFilter Members
void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent) { // Determine whether the parent is an embeddable editor element EmbeddableUIElementBase editorElement = parent as EmbeddableUIElementBase;
if ( editorElement != null ) { // Get the AllDayEventUIElement so we can get the associated Appointment/Holiday Infragistics.Win.UltraWinSchedule.DayView.AllDayEventUIElement allDayEventElement = null; allDayEventElement = editorElement.GetAncestor( typeof(Infragistics.Win.UltraWinSchedule.DayView.AllDayEventUIElement) ) as Infragistics.Win.UltraWinSchedule.DayView.AllDayEventUIElement;
if ( allDayEventElement != null ) { // The AllDayEvent element could represent either an Appointment or a Holiday. Appointment appointment = allDayEventElement.GetContext( typeof(Appointment) ) as Appointment; Holiday holiday = appointment == null ? allDayEventElement.GetContext( typeof(Holiday) ) as Holiday : null;
// Change the text displayed by the AllDayEvent element. TextUIElement textElement = allDayEventElement.GetDescendant( typeof(TextUIElement) ) as TextUIElement; if ( textElement != null ) textElement.Text = "Text changed"; } } }
bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent) { // Returns false so we don't bypass default processing. return false; }
#endregion}