tags:

views:

8

answers:

0

Hi,

I have a listbox in markup and a detail control. The listbox template defines a details button for each element. If this button is pressed a dependency property in the element's datasource is set to Visiblility == Visible. As long as I do have a selected item everything is OK. But if there is no selected item, the detail control is displayed always. Markup:

<Listbox x:Name="myListbox" />
<local:detailcontrol Visibility="{Binding ElementName=myListbox, Path=SelectedItem.DetailVisibility}" />

What I want is something like this:

<Listbox x:Name="myListbox" />
<local:detailcontrol Visibility="myListbox.SelectedItem != null ? {Binding ElementName=myListbox, Path=SelectedItem.DetailVisibility} : Visiblity.Hidden" />

Snippets both do not compile, but are provided to make my point clear.