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.

有帮助吗?

解决方案

I don't want to create a ConverterClass for each selection type.

You can have properties on the converter to parameterize it.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top