Warning: file_get_contents(/data/phpspider/zhask/data//catemap/4/wpf/14.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

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/sockets/2.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
Wpf 更改扩展器箭头_Wpf_Xaml - Fatal编程技术网

Wpf 更改扩展器箭头

Wpf 更改扩展器箭头,wpf,xaml,Wpf,Xaml,所以在玩扩展器控件的时候,我遇到了这个代码,可以在关闭时设置扩展器的颜色。但我注意到扩展器的箭头部分仍然是白色的。有没有办法移除箭头或给该区域上色 屏幕截图: 简单地说,我没有这方面的经验,我不知道如何编辑模板等 <Page xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="400"

所以在玩扩展器控件的时候,我遇到了这个代码,可以在关闭时设置扩展器的颜色。但我注意到扩展器的箭头部分仍然是白色的。有没有办法移除箭头或给该区域上色

屏幕截图:

简单地说,我没有这方面的经验,我不知道如何编辑模板等

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400" OpacityMask="#91000000">
    <StackPanel>
        <StackPanel.Resources>

            <Style TargetType="Border" x:Key="RacePitBorderStyle" >
                <Style.Resources>
                    <LinearGradientBrush x:Key="BackBrush" StartPoint="0.5,0" EndPoint="0.5,1">
                        <GradientStop Color="#EF3132" Offset="0.1" />
                        <GradientStop Color="#D62B2B" Offset="0.9" />
                    </LinearGradientBrush>
                </Style.Resources>
                <Setter Property="Background" Value="{StaticResource BackBrush}"/>
            </Style>

            <DataTemplate x:Key="titleText">
                <Border Style="{StaticResource RacePitBorderStyle}" Height="24">
                    <TextBlock Text="{Binding}" 
                        Margin="4 0"
                        VerticalAlignment="Center"
                        Foreground="White"
                        FontSize="11" 
                        FontWeight="Normal"
                        Width="{Binding
                        RelativeSource={RelativeSource
                        Mode=FindAncestor,
                        AncestorType={x:Type Expander}},
                        Path=ActualWidth}"
                        TextWrapping="Wrap"/>
                </Border>
            </DataTemplate>

            <Style TargetType="{x:Type Expander}">
                <Setter Property="HeaderTemplate" Value="{StaticResource titleText}"/>
            </Style>

        </StackPanel.Resources>

        <Expander Name="hcontCtrl" Header="This is the header.">
            <StackPanel>
                <TextBox>This is a textbox</TextBox>
                <Button>A button</Button>
            </StackPanel>
        </Expander>

    </StackPanel>
</Page>

这是一个文本框
钮扣

< /代码> 箭头是其中的一部分,你可以复制并修改它,或者从头开始创建自己。

我已经重新设计了扩展器,这样我就可以把箭头放在一些内容的中间。H.B.是正确的,如果你想重用默认的一个,你需要从混合中提取样式。RIGH当你把箭头放在中间时,你必须使用混合吗?如果不是的话,你会很乐意发布代码吗?我不再拥有代码或为客户工作,但我必须从Blend中提取模板。不幸的是,WPF就是这样工作的。