Timeline Footer

3 posts, 0 answers
  1. Ben
    Ben avatar
    3 posts
    Member since:
    Oct 2011

    Posted 03 Feb 2012 Link to this post

    Hello,

    I was wondering if it was possible to have a footer at the bottom of the timeline view.  For example, it could show the number of appointments in that day or month.
  2. Ben
    Ben avatar
    3 posts
    Member since:
    Oct 2011

    Posted 06 Feb 2012 Link to this post

    I was able to get what I wanted accomplished here.  I have a month-view timeline with resource grouping.  There's a panel docked at the top and bottom, with the scheduler docked to fill the center.

    The bottom panel is set to height 20.  In it, I have a RadLabel docked to the left side.  A RadGridView of height 40 is docked to the top in the center.  I had to set the grid height to at least 40 or else it would show scroll bars.  The DataSource of the RadGridView is a 1-row DataTable with 12 columns.

    To handle the column sizing and scrolling (if SchedulerTimescale.DisplayedCellsCount < 12), I added this to the Form_Load():

    TimelineGroupingByResourcesElement timeline = this.radScheduler1.SchedulerElement.ViewElement as TimelineGroupingByResourcesElement;
    List<SchedulerTimelineViewElement> elements = timeline.GetTimelineElements();
    elements[0].Header.Children[0].LayoutUpdated += new EventHandler(UpdateLayout);

    Here's the UpdateLayout() method:

    void UpdateLayout(object sender, EventArgs e)
            {
                TimelineGroupingByResourcesElement timeline = this.radScheduler1.SchedulerElement.ViewElement as TimelineGroupingByResourcesElement;
     
                //match label width to resource header width
                lblGridHeader.Width = timeline.ResourceHeaderWidth;
     
                List<SchedulerTimelineViewElement> elements = timeline.GetTimelineElements();
     
                //set main header title
                SchedulerHeaderCellElement headerElement = elements[0].Header.Children[0] as SchedulerHeaderCellElement;
                headerElement.Text = "Main Header Title";
     
                radGridView1.SuspendLayout();
     
                //hide every column
                for (int i = 0; i < radGridView1.Columns.Count; i++)
                {
                    radGridView1.Columns[i].IsVisible = false;
                }
                 
                for (int i = 1; i < elements[0].Header.Children.Count; i++)
                {
                    headerElement = elements[0].Header.Children[i] as SchedulerHeaderCellElement;
     
                    //shorten month column title to 3 letters
                    headerElement.Text = headerElement.Text.Substring(0, 3);
     
                    //unhide corresponding column and match column width
                    radGridView1.Columns[headerElement.Date.Month - 1].IsVisible = true;
                    radGridView1.Columns[headerElement.Date.Month - 1].Width = headerElement.Size.Width + 1;
                }
                radGridView1.ResumeLayout();
            }


    Hopefully this will be useful to anyone else with this requirement.
  3. UI for WinForms is Visual Studio 2017 Ready
  4. Ivan Todorov
    Admin
    Ivan Todorov avatar
    688 posts

    Posted 08 Feb 2012 Link to this post

    Hi Ben,

    I am glad to hear that you have solved your case. I am sure that the community will benefit from it. 

    Greetings,
    Ivan Todorov
    the Telerik team
    Sharpen your .NET Ninja skills! Attend Q1 webinar week and get a chance to win a license! Book your seat now >>
Back to Top