Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
115
Custom AllDayEvent appointment Text
posted

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?

Parents
  • 69832
    Offline posted

    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
    }

Reply Children