I have a Dock Panel and I want to set its height depending on a Property value.
The following compiles, but does not execute :
<DockPanel Grid.Row="1"
Visibility="{Binding Path=IsValid}" Margin="8,4">
<DockPanel.Triggers>
<Trigger Property="FrameworkElement.Visibility" Value="Visible">
<Setter Property="FrameworkElement.Height" Value="150"/>
</Trigger>
<Trigger Property="FrameworkElement.Visibility" Value="Hidden">
<Setter Property="FrameworkElement.Height" Value="0"/>
</Trigger>
</DockPanel.Triggers>
<ListBox Height="150"/>
</DockPanel>
What am I doing wrong? Any help, greatly appreciated.
Thanks
Joe
From MSDN:
So, for this to work you need a Style or a Template. I don’t think you wish to change the way your DockPanel looks, so Style it is: