1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
<Grid x:Name="LayoutRoot">
<ContentControl Margin="0,0,240,0" Height="152" VerticalAlignment="Top">
<ContentControl.Style>
<Style TargetType="{x:Type ContentControl}">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="{x:Type ContentControl}">
<StackPanel Orientation="Vertical">
<ToggleButton x:Name="btn" Height="25"/>
<Rectangle x:Name="rec" Height="50" Fill="red"/>
</StackPanel>
<ControlTemplate.Triggers>
<Trigger Property="IsChecked" Value="true" SourceName="btn" >
<Setter TargetName="rec" Property="Height" Value="200" />
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ContentControl.Style>
</ContentControl>
</Grid> |
Partager