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
20
Appointment Description in UltraDayView
posted

Hi,

I'm new to the NetAdvantage controls. I'm using UltraDayView control to show appointments with the Office2007 view style (UltraCalendarLook control used by UltraDayView has property ViewStyle set to Office2007). My problem is that with this style only Subject and Location are shown in appointments, but i can't find setting to show also Description (and Time) as are in default view style. Can somebody tell me if this is possible and how. Thanks.

 

 

Parents
  • 69832
    Offline posted

    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. There is a Knowledge base article which demonstrates how:
    http://devcenter.infragistics.com/Support/KnowledgeBaseArticle.aspx?ArticleID=7316

    Since the article was written before the Office2007 ViewStyle was introduced, the AfterCreateChildElements method must be modified in the following manner:
    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 );
                }
            }
        }
    }

Reply Children