Readonly Slots

2 posts, 1 answers
  1. Josh
    Josh avatar
    17 posts
    Member since:
    Aug 2012

    Posted 12 Feb 2013 Link to this post

    I am attempting to set some resources to be read only in a given a view. I am doing this by creating a slot but it is making all of my resources read only. I need the end user to be able to interact with 1 of the slots.

    Here is the code that I am using to set up the special slots. What else do I need to do to make this work?

    private void CreateReadOnlySlots()
           {
               EventSlots = new ObservableCollection<Slot>();
     
              Slot slot = new Slot() { Start = DateTime.MinValue, End = DateTime.MaxValue};
     
              foreach (EventType e in Enum.GetValues(typeof(EventType)))
              {
                  if (e != EventType.Macro)
                  {
                      slot.Resources.Add(new Resource(e.ToString(), "Event Type"));
                  }
              }
     
              slot.IsReadOnly = true;
              EventSlots.Add(slot);
           }

    The xmal for this control looks like this
    <telerik:RadScheduleView
                                 AppointmentsSource="{Binding TimelineData, Mode=TwoWay}"
                                 SpecialSlotsSource="{Binding EventSlots}"
                                 AppointmentEdited="eventsTimeline_AppointmentEdited_1"
                                 AppointmentSelectionChanged="eventsTimeline_AppointmentSelectionChanged_1"
                                 NavigationHeaderVisibility="Collapsed"
                                 ShowDialog="RadScheduleView_ShowDialog"
                                 ResourceTypesSource="{Binding EventTypes}"                               
                                 TimeRulerItemStyleSelector="{StaticResource TimeRulerItemStyleSelector}"
                                 GroupHeaderStyleSelector="{StaticResource GroupHeaderStyleSelector}"
                                 Name="eventsTimeline" VerticalAlignment="Top">
               <telerik:RadScheduleView.AppointmentSelectionBehavior>
                   <ecu:SingleAppointmentSelectionBehavior></ecu:SingleAppointmentSelectionBehavior>
               </telerik:RadScheduleView.AppointmentSelectionBehavior>
                
               <telerik:RadScheduleView.ViewDefinitions>
                   <telerik:DayViewDefinition
                       VisibleDays="1"
                       MajorTickLength="5min"
                       MinorTickLength="1min"
                       TimerulerMajorTickStringFormat="{}{0: HHmm}"
                       DayStartTime="00:00:00" DayEndTime="3:00:00" Orientation="Horizontal">
                   </telerik:DayViewDefinition>
               </telerik:RadScheduleView.ViewDefinitions>
               <telerik:RadScheduleView.AppointmentStyleSelector>
                   <ecu:EventStyleSelector
                           AudioEventStyle="{StaticResource AudioEvent}"
                           OdorEventStyle="{StaticResource OdorEvent}"
                           LightingEventStyle="{StaticResource LightingEvent}"
                           SmokeEventStyle="{StaticResource SmokeEvent}"/>
               </telerik:RadScheduleView.AppointmentStyleSelector>
     
               <telerik:RadScheduleView.GroupDescriptionsSource>
                   <telerik:GroupDescriptionCollection>
                       <telerik:ResourceGroupDescription ResourceType="Event Types" />
                   </telerik:GroupDescriptionCollection>
               </telerik:RadScheduleView.GroupDescriptionsSource>
           </telerik:RadScheduleView>
  2. Answer
    Yana
    Admin
    Yana avatar
    4960 posts

    Posted 15 Feb 2013 Link to this post

    Hello Josh,

    When assigning a Resource to the Slot, you should add a Resource from the Resources collection of the given ResourceType rather than creating a new Resource,  what I mean is the following code:

    slot.Resources.Add(new Resource(e.ToString(), "Event Type"));

    Except this, I cannot see nothing wrong with the provided code.  Please send us more details on how you're setting the resources, so we can provide further assistance.

    Kind regards,
    Yana
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top