I have the following codes:
One of my viewmodel's properties:
private ObservableCollection<ArukeresoShopMediator<T>> _shops;
public ObservableCollection<ArukeresoShopMediator<T>> Shops { ... }
ArukeresoShopMediator class:
class ArukeresoShopMediator<T>
where T : CheckArukeresoArCriteriaType, INotifyPropertyChanged
{
public Shop Shop { ... }
private T _data;
public T Data { ... }
public string Key { ... }
public string Name { ... }
private bool _checked;
public bool Checked { ... }
public ArukeresoShopMediator(T data, Shop shop) { ... }
}
UI part of the code:
<ListBox Grid.Row="2"
Grid.ColumnSpan="2"
Visibility="{Binding CompaniesVisibility}"
ItemsSource="{Binding Shops, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
<ListBox.ItemTemplate>
<DataTemplate>
<CheckBox IsChecked="{Binding Checked}" Content="{Binding}"></CheckBox>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
My problem is that there's a function that i'd like to execute within my viewmodel's Shops property's setter when the Checkbox property is changed but currently i have no idea how to do that.
As you can see Shops property is an ObservableCollection of type ArukeresoShopMediator which has a boolean Checked property. How can i make my Shops property respond to the Checked property's changes?