Hey, I'd like to create a combobox which contains filtering presets and then apply the filterdescriptors upon selection change using the MVVM-pattern. I'm able to add default filter descriptors but unable to get the filters updated afterwards programmatically from view-model. Everything is wired as TwoWay and are raising PropertyChanged and is set as UpdateSourceTriggers.
Preset-collection for the combobox:
private ObservableCollection<KeyValuePair<string, ObservableCollection<FilterDescriptor>>> filterPresets;
public ObservableCollection<KeyValuePair<string, ObservableCollection<FilterDescriptor>>> FilterPresets
{ ... }
Selected item of the Preset-combobox which should update the actual filtering collection upon change:
private KeyValuePair<string, ObservableCollection<FilterDescriptor>> selectedPreset;
public KeyValuePair<string, ObservableCollection<FilterDescriptor>> SelectedPreset
{
get { return selectedPreset; }
set
{
if (selectedPreset.Key != value.Key)
{
selectedPreset = value;
FilterDescriptors = selectedPreset.Value;
OnPropertyChanged();
}
}
}
Actual filter descriptor collection bound to the datafilter using FilterDescriptorBindingBehavior.FilterDescriptors:
private ObservableCollection<FilterDescriptor> filterDescriptors;
public ObservableCollection<FilterDescriptor> FilterDescriptors
{ ... }
Looking forward for your reply,
LM IT
Preset-collection for the combobox:
private ObservableCollection<KeyValuePair<string, ObservableCollection<FilterDescriptor>>> filterPresets;
public ObservableCollection<KeyValuePair<string, ObservableCollection<FilterDescriptor>>> FilterPresets
{ ... }
Selected item of the Preset-combobox which should update the actual filtering collection upon change:
private KeyValuePair<string, ObservableCollection<FilterDescriptor>> selectedPreset;
public KeyValuePair<string, ObservableCollection<FilterDescriptor>> SelectedPreset
{
get { return selectedPreset; }
set
{
if (selectedPreset.Key != value.Key)
{
selectedPreset = value;
FilterDescriptors = selectedPreset.Value;
OnPropertyChanged();
}
}
}
Actual filter descriptor collection bound to the datafilter using FilterDescriptorBindingBehavior.FilterDescriptors:
private ObservableCollection<FilterDescriptor> filterDescriptors;
public ObservableCollection<FilterDescriptor> FilterDescriptors
{ ... }
Looking forward for your reply,
LM IT