How to enable/disable a Button depending on the selection's type in WPF?
Question
I want to trigger a button's enabled state, according to the type of the current selection.
E.g. I have a treeview that displayes parents and their children. If the selection is on a 'parent' item, the button 'btnShowParentData' is enabled. I've done this via ValueConvertion:
<Button name="btnShowParentData" IsEnabled="{Binding ElementName=tree, Path=SelectedValue, Converter={StaticResource ParentSelectedConv}}" />
I look for a more elegant way. I don't want to create a ConverterClass for each selection type.
Solution
I don't want to create a ConverterClass for each selection type.
You can have properties on the converter to parameterize it.
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow