|
MainPage.XAML:
<combobox:SfComboBox DataSource="{Binding EmployeeCollection}" Style="{StaticResource EscavoxComboboxStyle}" SelectedItem="{Binding SelectedInventory, Mode=TwoWay}" DisplayMemberPath="Name" SelectedValuePath="ID" Text="Select Employee" /> <Button x:Name="btnClearSelection" Text="Clear Selection" Command="{Binding ButtonCommand}" /> EmployeeViewModel.Cs: public ICommand ButtonCommand => new Command(SetSelectedValueToNull); private void SetSelectedValueToNull() { this.SelectedInventory = null; } |



|
MainPage.XAML: <combobox:SfComboBox DataSource="{Binding EmployeeCollection}" Style="{StaticResource EscavoxComboboxStyle}" SelectedItem="{Binding SelectedInventory, Mode=TwoWay}" DisplayMemberPath="Name" SelectedValuePath="ID" Text="Select Employee" /> <Button x:Name="btnClearSelection" Text="Clear Selection" Command="{Binding ButtonCommand}" CommandParameter="{x:Reference comboBox}"/> EmployeeViewModel.Cs: public ICommand ButtonCommand => new Command(SetSelectedValueToNull); private void SetSelectedValueToNull() { this.SelectedInventory = null; (comboBox as Syncfusion.XForms.ComboBox.SfComboBox).Text = "Select Employee"; } |