Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/csharp/321.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 展开时更改扩展器标题文本_C#_Wpf_Xaml - Fatal编程技术网

C# 展开时更改扩展器标题文本

C# 展开时更改扩展器标题文本,c#,wpf,xaml,C#,Wpf,Xaml,我有一个扩张器,它将收割台旋转-90度: <Expander Name="exProduct" Grid.Column="1" ExpandDirection="Left" HorizontalAlignment="Right" VerticalAlignment="Stretch"> <Expander.Header> <TextBlock Text="Add Product" FontSize="18"

我有一个扩张器,它将收割台旋转-90度:

<Expander Name="exProduct" Grid.Column="1" ExpandDirection="Left" 
          HorizontalAlignment="Right" VerticalAlignment="Stretch">
    <Expander.Header>
        <TextBlock Text="Add Product" FontSize="18"        
            <TextBlock.LayoutTransform>                
                <RotateTransform Angle="-90"/>             
            </TextBlock.LayoutTransform>
        </TextBlock>
    </Expander.Header>


您想隐藏标题还是只更改文本?您的代码应该可以工作。只需从样式外部删除标题。也就是说,仅在样式中设置标题。
<Window.Resources>
<Style x:Key="ExpanderEx" TargetType="Expander">
<Setter Property="Header" Value="Show"/>
<Style.Triggers>
<Trigger Property="IsExpanded" Value="True">
<Setter Property="Header" Value="Hide"/>
</Trigger>
</Style.Triggers>
</Style>
</Window.Resources> 

<Expander Style="{StaticResource ExpanderEx}" >

<StackPanel>
    <Button Width="100" Height="50"/>
</StackPanel>
</Expander>