Hi,
I have the following in my XAML:
<Grid Grid.Row="1" Margin="10" x:Name="GridDate" Opacity="0" IsVisible="False">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<SyncfusionPicker:SfDatePicker Grid.Row="0" x:Name="PickerServiceDate" HeaderText="Select a Date" PickerMode="Dialog" PickerHeight="300" PickerWidth="300" ShowFooter="True">
<SyncfusionPicker:SfDatePicker.FooterView>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<SyncfusionButtons:SfButton Grid.Column="0" Margin="5" BackgroundColor="Blue" Text="Previous" CornerRadius="10" Command="{Binding Path=BindingContext.BackToServices}" />
<SyncfusionButtons:SfButton Grid.Column="1" Margin="5" BackgroundColor="Red" Text="Next" CornerRadius="10" Command="{Binding Path=BindingContext.GoToTime}" />
</Grid>
</SyncfusionPicker:SfDatePicker.FooterView>
</SyncfusionPicker:SfDatePicker>
</Grid>
<Grid Grid.Row="1" Margin="10" x:Name="GridTime" Opacity="0" IsVisible="False">
<Grid.RowDefinitions>
<RowDefinition Height="*" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<SyncfusionPicker:SfTimePicker Grid.Row="0" x:Name="PickerServiceTime" HeaderText="Select a Time" PickerMode="Dialog" PickerHeight="300" PickerWidth="300" />
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<SyncfusionButtons:SfButton x:Name="ButtonBackToDate" Grid.Column="0" Margin="5" BackgroundColor="Blue" Text="Previous" CornerRadius="10" Clicked="ButtonBackToDate_Clicked" />
<SyncfusionButtons:SfButton x:Name="ButtonGoToXXXX" Grid.Column="1" Margin="5" BackgroundColor="Red" Text="Next" CornerRadius="10" Clicked="ButtonGoToXXXX_Clicked" />
</Grid>
</Grid>
and the Command ViewModal is like this:
public class HomePageViewModel : INotifyPropertyChanged
{
public Command<object> BackToServices { get; set; }
public Command<object> GoToTime { get; set; }
public HomePageViewModel()
{
BackToServices = new Command<object>(OnBackToServices);
GoToTime = new Command<object>(OnGoToTime);
}
private void OnBackToServices(object obj)
{
App.Current.MainPage.DisplayAlert("Message", "Item Deleted :", "Ok");
}
private void OnGoToTime(object obj)
{
GridDate.FadeTo(0, 1000);
GridDate.IsVisible = false;
GridTime.IsVisible = true;
GridTime.FadeTo(1, 1000);
PickerServiceTime.IsOpen = true;
}
public event PropertyChangedEventHandler PropertyChanged;
public void OnPropertyChanged(string name)
{
if (this.PropertyChanged != null) PropertyChanged(this, new PropertyChangedEventArgs(name));
}
}
How can I access the GridTime from the SfDatePicker's Command when the user clicks on the button (higlighted above)?
Thanks,
Jassim