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
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