Hello,
I'm using ScheduleView in this scenario where I've extended the Appointment Class with my own custom class (ActivityWrapper
). My class stores a brush as a property in order to establish a binding to the AppointmentItemBaseStyle Background property, and that way, to present the Appointments in the Schedule view with a controlled color range.
The style
I'm using ScheduleView in this scenario where I've extended the Appointment Class with my own custom class (ActivityWrapper
). My class stores a brush as a property in order to establish a binding to the AppointmentItemBaseStyle Background property, and that way, to present the Appointments in the Schedule view with a controlled color range.
The style
<Style x:Key="AppointmentItemBaseStyle" TargetType="telerik_GeneralScheduleView:AppointmentItem"> <Setter Property="Background" Value="{Binding Converter={StaticResource AppointmentToActivityWrapperColor}}" /> <Setter Property="BorderBrush" Value="{StaticResource RadScheduleForeground}" /> <Setter Property="HorizontalContentAlignment" Value="Stretch" /> <Setter Property="VerticalContentAlignment" Value="Stretch" /> <Setter Property="Foreground" Value="Black" /> <Setter Property="BorderThickness" Value="1" /> <Setter Property="Padding" Value="2 0 0 0" /> <Setter Property="ContentTemplate" Value="{StaticResource AppointmentItemTemplate}" /> <Setter Property="Template" Value="{StaticResource AppointmentItemHorizontalControlTemplate}" /> <Setter Property="Canvas.ZIndex" Value="1" /> </Style> The converter
However, when I scroll in the schedule view, or edit some appointment, the colors of the Apppointments interchange erroneously- I believe there is some bug in the control, because the bounded objects keep their state. Can you acknowledge and provide any solution? Thank you, Franciscopublic
object
Convert(
object
value, Type targetType,
object
parameter, System.Globalization.CultureInfo culture)
{
try
{
AppointmentItemProxy aip = value
as
AppointmentItemProxy;
if
(aip !=
null
)
{
ActivityWrapper aw = ((ActivityWrapper)aip.Appointment);
if
(aw.IsEnabled)
return
aw.Color;
else
return
new
SolidColorBrush(Colors.LightGray);
}
else
return
new
SolidColorBrush(Colors.LightGray);
}
catch
(Exception ex)
{
LoggingManager.Error(
"Module.ActivitySet.Silverlight"
,
"AptmColorToBackgroundConverter"
,
"Convert"
,
"General failure"
, ex);
return
null
;
}
}