|
<Grid x:Name="GridView">
<Grid.Resources>
<ResourceDictionary>
<local:ItemsCountConverter x:Key ="countConverter" />
</ResourceDictionary>
</Grid.Resources>
<Grid.BindingContext>
<local:AgendaViewModel/>
</Grid.BindingContext>
<Grid.RowDefinitions>
<RowDefinition Height="0.7*"/>
<RowDefinition Height="0.3*"/>
</Grid.RowDefinitions>
<schedule:SfSchedule x:Name="schedule" Grid.Row="0"
BindingContext="{Binding}"
ScheduleView="MonthView"
SelectedDate="{Binding SelectedDate, Mode=TwoWay}"
DataSource="{Binding Meetings}">
<schedule:SfSchedule.ShowAppointmentsInline>
<OnPlatform x:TypeArguments="x:Boolean">
<On Platform="Android,iOS">False</On>
<On Platform="UWP">True</On>
</OnPlatform>
</schedule:SfSchedule.ShowAppointmentsInline>
<schedule:SfSchedule.AppointmentMapping>
<schedule:ScheduleAppointmentMapping
StartTimeMapping="From"
EndTimeMapping="To"
SubjectMapping="EventName"
ColorMapping="color">
</schedule:ScheduleAppointmentMapping>
</schedule:SfSchedule.AppointmentMapping>
</schedule:SfSchedule>
<Grid x:Name="ListView" Grid.Row="1">
<Grid.RowDefinitions>
<RowDefinition Height="0.2*"/>
<RowDefinition Height="*"/>
</Grid.RowDefinitions>
<Label Grid.Row="0"
x:Name="SelectedDate"
HorizontalOptions="Start"
Text="{Binding SelectedDate}"
TextColor="Black"
FontAttributes="Bold"
FontSize="14"
VerticalOptions="Start" />
<Grid Grid.Row="1">
<listview:SfListView ItemsSource="{Binding OrderedMeetings}">
<listview:SfListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<Grid Margin="2,1,1,1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="0.02*"/>
<ColumnDefinition Width="0.78*"/>
<ColumnDefinition Width="0.2*"/>
</Grid.ColumnDefinitions>
<Grid
BackgroundColor="{Binding color}"
Grid.Column="0" >
</Grid>
<Label
Text="{Binding EventName}"
Grid.Column="1"
VerticalOptions="Center"
LineBreakMode="TailTruncation"
TextColor="Black" >
</Label>
<Grid
Margin="2"
Grid.Column="2">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Label
Text="{Binding From, StringFormat='{}{0:hh:mm tt}'}}"
Grid.Row="0"
VerticalOptions="Center"
FontSize="10"
TextColor="Gray" >
</Label>
<Label
Text="{Binding To, StringFormat='{}{0:hh:mm tt}'}}"
Grid.Row="1"
VerticalOptions="Center"
FontSize="10"
TextColor="Gray">
</Label>
</Grid>
</Grid>
</ViewCell>
</DataTemplate>
</listview:SfListView.ItemTemplate>
</listview:SfListView>
<Label
Margin="5,0,0,0"
BindingContext="{Binding}"
Text="No Meetings"
IsVisible="{Binding SelectedDateMeetings, Converter={StaticResourcecountConverter}}" />
</Grid>
</Grid>
</Grid>
<ContentPage.Behaviors>
<local:AgendaViewBehavior/>
</ContentPage.Behaviors> |
|
private void ScheduleCellTapped(object sender, CellTappedEventArgs e)
{
var viewModel = (this.schedule.BindingContext as AgendaViewModel);
if (e.Appointments != null)
{
viewModel.SelectedDateMeetings = new ObservableCollection<Meeting>();
foreach (var item in e.Appointments)
{
viewModel.SelectedDateMeetings.Add(item as Meeting);
viewModel.OrderedMeetings = viewModel.SelectedDateMeetings.OrderBy(a => a.From).ToList();
}
}
} |