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;

    The xmal for this control looks like this
                                 AppointmentsSource="{Binding TimelineData, Mode=TwoWay}"
                                 SpecialSlotsSource="{Binding EventSlots}"
                                 ResourceTypesSource="{Binding EventTypes}"                               
                                 TimeRulerItemStyleSelector="{StaticResource TimeRulerItemStyleSelector}"
                                 GroupHeaderStyleSelector="{StaticResource GroupHeaderStyleSelector}"
                                 Name="eventsTimeline" VerticalAlignment="Top">
                       TimerulerMajorTickStringFormat="{}{0: HHmm}"
                       DayStartTime="00:00:00" DayEndTime="3:00:00" Orientation="Horizontal">
                           AudioEventStyle="{StaticResource AudioEvent}"
                           OdorEventStyle="{StaticResource OdorEvent}"
                           LightingEventStyle="{StaticResource LightingEvent}"
                           SmokeEventStyle="{StaticResource SmokeEvent}"/>
                       <telerik:ResourceGroupDescription ResourceType="Event Types" />
  2. Answer
    Yana avatar
    5015 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,
    the Telerik team

    Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

Back to Top