문제

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