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

Apply different stype to slots.

1 Answer 45 Views
ScheduleView
This is a migrated thread and some comments may be shown as answers.
hardik
Top achievements
Rank 1
hardik asked on 13 Jun 2011, 02:09 PM
Hi telerik,

I want to apply different style for different slots. Like 12:00 pm to 05:00 pm shows as gray color,  06:00pm to 8:00 pm shows  as red color.

How is it possible?

I see  one of the link of yours forum and found one example also, but its not working.See below link

http://www.telerik.com/community/forums/silverlight/scheduleview/specialslot-in-monthview.aspx

I have done it like that, but I found that at debug time specialSlotStyleSelector class not shows item as my custom class.

\=====================SpecialStyleSlotSelctor class=============================

 public override Style SelectStyle(object item, DependencyObject container, ViewDefinitionBase activeViewDefinition)
    {
      Slot slot = item as Slot;
     
      if (slot.IsReadOnly)
      {
        return this.ReadOnlyStyle;
      }
      else if (activeViewDefinition is MonthViewDefinition)
      {
        return this.MonthViewStyle;
      }
      else
      {
        if (item is TimeSlot) // TimeSlot is my custom class.
        {
          TimeSlot timeSlot = (TimeSlot)item;

          if (timeSlot.IsReserved)
          {
            return this.ReservedStyle;
          }
          else if (timeSlot.IsNonWorkHour)
          {
            return this.NonWorkingHourStyle;
          }
        }
      }


==================TimeSlot Class ==============================

public class TimeSlot : Slot
  {
    private bool isNonWorkHour;
    private bool isReserved;

    public TimeSlot()
      : base()
    {
    }

     public TimeSlot(Slot slot)
      : base(slot)
    {
    }

    public TimeSlot(DateTime start, DateTime end)
      : base(start, end)
    {
    }    
    public bool IsNonWorkHour
    {
      get
      {
        return this.isNonWorkHour;
      }

      set
      {
        this.isNonWorkHour = value;

        this.OnPropertyChanged("IsNonWorkHour");
      }
    }  
  }

Waiting for your positive and early response.  Its very good If I can get one example related to this with Viewmodel.

Thanks
Hardik

1 Answer, 1 is accepted

Sort by
0
Konstantina
Telerik team
answered on 15 Jun 2011, 12:21 PM
Hello Hardik,

You can also check out this blog post and this online demo for further information about how to create special TimeSlots.

Please let us know if you still experience difficulties.

Kind regards,
Konstantina
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
ScheduleView
Asked by
hardik
Top achievements
Rank 1
Answers by
Konstantina
Telerik team
Share this question
or