我们如何改变扩展器圆形图标wpf

时间:2014-05-29 12:48:55

标签: wpf expander

我正在开发wpf应用程序。我想删除扩展器圆形图标。下面是我的扩展器代码。在此先感谢。我也想删除CornerRadius

<Expander x:Name="Expander" HorizontalAlignment="Right" FlowDirection="RightToLeft"    Foreground="White" FontFamily="segoe_uilight"  Width="200px"    BorderBrush="#FF0A0909" BorderThickness="1,1,1,2" Background="#99080707" >
            <Expander.Header>
                <StackPanel Orientation="Horizontal">

                    <Canvas Height="22" Width="172px" VerticalAlignment="Bottom">

                      // here is some code
                    </Canvas>
                </StackPanel>
            </Expander.Header>

            <!--<Expander.Content>
                <TextBox Text="LoginUserName"></TextBox>
            </Expander.Content>-->
            <StackPanel Margin="10,4,0,0"  >
                <StackPanel Orientation="Horizontal" Height="35">

                   // Here is some code

                </StackPanel>
                <!--<Label Margin="4" Content="Logout"  />-->
                <!--<Button x:Name="btnLogout" Margin="4" Content="Logout" Click="btnLogout_Click_1"></Button>-->

                <StackPanel Orientation="Horizontal" Height="35">

                    <Label x:Name="btnLogout" HorizontalAlignment="Left" Margin="60,5,0,0" Content="Logout"  Foreground="White" FontFamily="segoe_uilight" BorderThickness="0" MouseUp="btnLogout_MouseUp">

                    </Label>
                    <Image  Source="img\icons\logout.png" Height="20px" Width="20px"  Margin="25,0,0,0"/>
                </StackPanel>
            </StackPanel>
        </Expander>`

1 个答案:

答案 0 :(得分:0)

尝试使用该代码:

<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="400">
    <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>