Group by viewdefinitions

2 posts, 0 answers
  1. Sebastien
    Sebastien avatar
    1 posts
    Member since:
    Nov 2013

    Posted 27 Nov 2013 Link to this post

    Hello,
    I currently group data as follow:

    <telerik:RadScheduleView.ViewDefinitions>

    <telerik:DayViewDefinition Title="{res:Res Static=loc:ResourceIntervention.DayPlanning, Default='Jour!'}"/>

    <telerik:WeekViewDefinition Title="{res:Res Static=loc:ResourceIntervention.WeekPlanning, Default='Semaine!'}"/>

    <telerik:MonthViewDefinition Title="{res:Res Static=loc:ResourceIntervention.MonthPlanning, Default='Mois!'}"/>

    </telerik:RadScheduleView.ViewDefinitions>

    <telerik:RadScheduleView.GroupDescriptionsSource>

         <telerik:GroupDescriptionCollection>

             <telerik:DateGroupDescription />

             <telerik:ResourceGroupDescription ResourceType="Technicians" />

         </telerik:GroupDescriptionCollection>

    </telerik:RadScheduleView.GroupDescriptionsSource>

    I would like to group data by "date" and"Technicians" only in the day view definition.
    In the week view definition, I would like to group by "Date" only.
    Is it possible?

    Kind regards,
    Sebastien

  2. Kalin
    Admin
    Kalin avatar
    1207 posts

    Posted 29 Nov 2013 Link to this post

    Hello Sebastien,

    The explained scenario can be achieved by handling the VisibleRangeChanged event of the ScheduleView. Inside of the handler you can check which is the current ActiveViewDefinition and change the GroupDescriptionSource of the ScheduleView. Check the following code snippet of the VisibleRangeChanged event handler:

    private void ScheduleView_VisibleRangeChanged(object sender, EventArgs e)
    {
        var scheduleView = sender as RadScheduleView;
        if (scheduleView.ActiveViewDefinition is WeekViewDefinition)
        {
            this.ScheduleView.GroupDescriptionsSource = new GroupDescriptionCollection
            {
                new DateGroupDescription()
            };
        }
        else if (scheduleView.ActiveViewDefinition is DayViewDefinition)
        {
            this.ScheduleView.GroupDescriptionsSource = new GroupDescriptionCollection
            {
                new DateGroupDescription(),
                new ResourceGroupDescription { ResourceType = "Technicians" }
            };
        }
    }

    Hope this will work for you.

    Regards,
    Kalin
    Telerik
    TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WPF.
    Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
    Sign up for Free application insights >>
  3. UI for WPF is Visual Studio 2017 Ready
Back to Top