I've been struggling with this control to make it bind to an Observable
Collection of ints. Basically, I want to use this control as a picker where the
DataSource is a list of int values, and bind the selectedItem to an int in a
different class.
The idea would be to have the following:
public MyClass :
INotifyPropertyChanged
{
private int _Value;
public int Value
{
get => _Value;
set
{
_Value = value;
OnPropertyChanged();
}
}
}
public ComboBoxViewModel
{
public MyClass myClass {get; set;} = new
MyClass();
public ObservableCollection<int>
Options {get; set;} = new ObservableCollection<int>(){ 2, 4, 8,
16};
}
XAML:
<SfComboBox:SfComboBox DataSource =
"{Binding Options}"
SelectedItem = "{Binding myClass.Value, Mode=TwoWay}" />
I am not even getting the list of Options in my
combobox.
Thanks!