I created a status bar:
<StatusBar> <StatusBarItem > <WrapPanel> <Image Source="/MyApp;component/Images/icon.png" /> <TextBlock Name="_StatusbarUser" Text="Username" /> </WrapPanel> </StatusBarItem> </StatusBar>
How to create a trigger, when I set the visibility of a text block to collapse, it will also be displayed as a status column of the trigger's parent.
I try to use the style below, but did not work
<StatusBar Grid.Row="2" Name="_Statusbar"> <StatusBar.Resources> <Style TargetType="{x:Type StatusBarItem}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource AncestorType={x:Type TextBlock}}, Path=Visibility}" Value="Collapsed"> <Setter Property="Visibility" Value="Collapsed"/> </DataTrigger> </Style.Triggers> </Style> </StatusBar.Resources> <StatusBarItem> <WrapPanel> <Image Source="/MyApp;component/Images/icon.png" /> <TextBlock Name="_StatusbarUser" Text="Username" /> </WrapPanel> </StatusBarItem> </StatusBar>
Please help, thanks
source share