<ListView Grid.Row="1" Background="{TemplateBinding Background}"BorderBrush="Transparent">
<ListView.ItemsSource>
<MultiBinding Converter="{StaticResource AppoitmentConverter}">
<Binding RelativeSource="{RelativeSource Mode=FindAncestor, AncestorType={x:Typesyncfusion:MonthViewItem}, AncestorLevel=1}" Path="Appointments"/>
<Binding Path="Date"RelativeSource="{RelativeSource Mode=TemplatedParent}"/>
</MultiBinding>
</ListView.ItemsSource>
<ListView.ItemTemplate>
<DataTemplate>
<WrapPanel>
<TextBlock Background="{Binding AppointmentBackground}" Text="{Binding Path=Subject}"Foreground="White"/>
</WrapPanel>
</DataTemplate>
</ListView.ItemTemplate>
</ListView> |
public object Convert(object[] values, Type targetType, object parameter, CultureInfo culture)
{
Appointments = new ScheduleAppointmentCollection();
var VisibleAppointments = values[0] asScheduleAppointmentCollection;
var Date = values[1] as DateTime?;
if (VisibleAppointments == null || VisibleAppointments?.Count == 0)
return Appointments;
for (int i = 0; i < VisibleAppointments.Count; i++)
{
if (VisibleAppointments[i].StartTime.Date.Equals(Date))
Appointments.Add(VisibleAppointments[i]);
}
return Appointments;
} |