Hello
I have a problem with CombobBox.
In my ComboBox I want have Items as CheckBox and text. I want use this solutin in WPF application with MVVM Light.
This is my code:
View:
<syncfusion:ComboBoxAdv
Margin="10,0,10,0"
Grid.Column="0"
Grid.ColumnSpan="3"
FontSize="15"
AllowMultiSelect="True"
SelectedItems="{Binding SelectedDataGridColumns, Mode=TwoWay,UpdateSourceTrigger=PropertyChanged}"
ItemsSource="{Binding DataGridColumn, Mode=TwoWay}"/>
----------------------------------------------------------------------------------------------------------------------------------------------
ViewModel:
public class ListUsersViewModel : ViewModelBase
{
private ObservableCollection selectedDataGridColumns;
public ObservableCollection SelectedDataGridColumns
get { return selectedDataGridColumns; }
Set(ref selectedDataGridColumns, value);
ShowDataGridColumn(); // my method which sets the visibility of columns
private ObservableCollection dataGridColumn;
public ObservableCollection DataGridColumn
get { return dataGridColumn; }
Set(ref dataGridColumn, value);
public ListUsersViewModel()
DataGridColumn = new ObservableCollection<string>()
SelectedDataGridColumns = new ObservableCollection<object>()
}
public void ShowDataGridColumn()
{
// When the SelectedDataGridColumns will be changing I want call the this method
}
----------------------------------------------------------------------------------------------------------------------------------------------
I set break Point in SelectedDataGridColumns (set) and run my application.
SelectedDataGridColumns (set) is call twice:
1. When value.Count is = 2
2. When value.Count is = 0
and finaly SelectedDataGridColumns in ComboBox is 0 (This is ine problem)
A second problem:
When I selected item with ComboBox program go to SelectedDataGridColumns (set) and value = NULL
When I selected item second time with ComboBox program doing nothing, don't enter to SelectedDataGridColumns (set)
This solution don't work, The same problems.
https://www.syncfusion.com/kb/5792/how-to-select-items-from-comboboxadv-control-at-startup
Pleace help me :)