I'm using the MarkupExtension
outlined in this answer for binding my enum
s to ComboBox
s:
Databinding an enum property to a ComboBox in WPF
Which is convenient because it allows me to do something like this:
<ComboBox
ItemsSource="{util:Enumeration {x:Type viewModels:MyEnumTypeE}}"
DisplayMemberPath="Description"
SelectedValue="{Binding MyEnumValue, FallbackValue=0}"
SelectedValuePath="Value" />
which is what I'm used to seeing when I bind my ComboBox
s to most anything else.
I'm having trouble, however, because now I need to filter out certain enumeration values. I also need to selectively filter them out at run-time, so that sometimes all of my enum
values are displayed, and sometimes only a few of the values are displayed.
This question, Binding WPF ComboBox to enum and hiding certain values, seemed like the perfect title to answer the question, but they are using the ObjectDataProvider
which I am not. I suppose I could always default back to using that if I really needed to, but since the MarkupExtension
is just so darn convenient, I would like to continue using that instead.
My question is: how could I filter out some enum
values from my ComboBox
while still using this MarkupExtension
?