Combobox binding breaks after button click wpf mvvm. I have used interaction trigger to bind combobox selection changed to an ICommand.
<ComboBox IsEditable="True" Text="Please Select" IsReadOnly="True" ItemsSource="{Binding Items}" SelectedItem="{Binding SelectedItem}">
<i:Interaction.Triggers>
<i:EventTrigger EventName="SelectionChanged">
<i:InvokeCommandAction Command="{Binding SelectionChangedCommand}" />
</i:EventTrigger>
</i:Interaction.Triggers>
</ComboBox>
<Button Content="Save" Command="{Binding SaveCommand}" />
Binding works fine till save button's command is fired. Once save command of button is fired, combobox selectionchange command breaks
Edit: Items is a list of string like below
"A1", "A2", "A3", "A4", "A5", "A6", "A7", "A8",
"B1", "B2", "B3", "B4", "B5", "B6", "B7", "B8",
"C1", "C2", "C3", "C4", "C5", "C6", "C7", "C8",
"D1", "D2", "D3", "D4", "D5", "D6", "D7", "D8"
Selected item is displayed in a readonly textbox and when the alphabet changes, SelectionChangedCommand binding breaks (SelectedItem is no longer updated but, on clicking save, its updated).
Note that Combobox's SelectedItem is bound to below property of ViewModel.
private string _SelectedItem;
public string SelectedItem
{
get
{
return _SelectedItem;
}
set
{
if (_SelectedItem!= value)
{
_SelectedItem= value;
RaisePropertyChanged(() => SelectedItem);
}
}
}
SelectionChangedCommandfrom Telerik?SelectedItemno longer gets updated? TheSelectionChangedCommandno longer executes? TheCanExecuteno longer returns true? It could be any number of things, I don't think we can tell with the limited information provided. And can you share what yourSaveCommanddoes to theSelectedItem? (doesn't have to be the exact calculation code, but does it change theSelectedItemvalue? do anything else related to theSelectChangedCommandor itsCanExecute?