This is a migrated thread and some comments may be shown as answers.

Custom mapping between multiple ResourceType-s

1 Answer 41 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
Alin
Top achievements
Rank 1
Alin asked on 27 Mar 2015, 12:44 PM
Hello,
I have a RadScheduleView displaying Appointments for Room-s and Speaker-s resources using a TimelineViewDefinition:

<UserControl x:Class="Scheduler.Views.SchedulerView"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:telerik="http://schemas.telerik.com/2008/xaml/presentation"
             xmlns:views="clr-namespace:Scheduler.Views"
             mc:Ignorable="d"
             d:DesignHeight="300" d:DesignWidth="300">
     
    <UserControl.DataContext>
        <views:SchedulerViewModel/>
    </UserControl.DataContext>
     
    <Grid>
         
        <telerik:RadScheduleView AppointmentsSource="{Binding Appointments}"
                                 ResourceTypesSource="{Binding ResourcesTypes}" >
 
            <telerik:RadScheduleView.ViewDefinitions>
                <!--<telerik:DayViewDefinition />
                <telerik:WeekViewDefinition />
                <telerik:MonthViewDefinition/>-->
                <telerik:TimelineViewDefinition MinTimeRulerExtent="1000" VisibleDays="2"
                                                MinorTickLength="1h" MajorTickLength="6h" GroupTickLength="1d"
                                                />
            </telerik:RadScheduleView.ViewDefinitions>
 
            <telerik:RadScheduleView.GroupDescriptionsSource>
                <telerik:GroupDescriptionCollection>
                    <telerik:DateGroupDescription />
                    <telerik:ResourceGroupDescription ResourceType="Room"/>
                    <telerik:ResourceGroupDescription ResourceType="Speaker"/>
                </telerik:GroupDescriptionCollection>
            </telerik:RadScheduleView.GroupDescriptionsSource>
 
            <telerik:RadScheduleView.GroupHeaderContentTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding FormattedName}" Width="70" Margin="10" VerticalAlignment="Center" />
                </DataTemplate>
            </telerik:RadScheduleView.GroupHeaderContentTemplate>
        </telerik:RadScheduleView>
 
    </Grid>
     
</UserControl>


using System.Collections.ObjectModel;
using Telerik.Windows.Controls;
using Telerik.Windows.Controls.ScheduleView;
 
namespace Scheduler.Views
{
    public class SchedulerViewModel
    {
        public SchedulerViewModel()
        {
            ResourcesTypes = GenerateResourceTypes();
            Appointments   = new ObservableCollection<Appointment>();
        }
 
        public ObservableCollection<Appointment> Appointments { get; set; }
 
        public ObservableCollection<ResourceType> ResourcesTypes { get; set; }
 
        private ObservableCollection<ResourceType> GenerateResourceTypes()
        {
            var result = new ObservableCollection<ResourceType>();
 
            var roomType = new ResourceType("Room");
            var room1 = new Resource("Room Alfa");
            var room2 = new Resource("Room Beta");
            var room3 = new Resource("Room Gama");
            roomType.Resources.Add(room1);
            roomType.Resources.Add(room2);
            roomType.Resources.Add(room3);
 
            var speakerType = new ResourceType("Speaker");
            var speaker1 = new Resource("Tom");
            var speaker2 = new Resource("Bob");
            var speaker3 = new Resource("John");
            speakerType.Resources.Add(speaker1);
            speakerType.Resources.Add(speaker2);
            speakerType.Resources.Add(speaker3);
 
            result.Add(roomType);
            result.Add(speakerType);
 
            return result;
        }
    }
}


Is it possible to create a custom mapping between Room-s and Speaker-s so that for "Room Alfa" and "Room Beta" only two speakers would be displayed "Bob" and "John" (only "Bob" and "John" have access to "Room Alfa" and "Room Beta"); and for "Room Gama" to display all the speakers "Tom", "Bob", "John" (all speakers have access to "Room Gama").

Please see the attached file for more details.

Thank you,
Marius

1 Answer, 1 is accepted

Sort by
0
Kalin
Telerik team
answered on 31 Mar 2015, 11:23 AM
Hello Marius,

I'm afraid that with its current implementation, the ScheduleView control doesn't support hierarchical resources. However we have a SDK example that demonstrates how to simulate such a look using a TreeView control and a single level of Resources. You can find it on the following link:
https://github.com/telerik/xaml-sdk/tree/master/ScheduleView/HierarchicalGroupingAndFilteringWithTreeView

Hope this helps.

Regards,
Kalin
Telerik
 

See What's Next in App Development. Register for TelerikNEXT.

 
Tags
ScheduleView
Asked by
Alin
Top achievements
Rank 1
Answers by
Kalin
Telerik team
Share this question
or