首页 新闻 会员 周边 捐助

WPF中怎样把菜单的这个分割线去掉????

0
悬赏园豆:50 [已关闭问题] 关闭于 2013-12-16 14:47

 <SolidColorBrush x:Key="MenuItemSelectionFill" Color="#A0C3E9"/>
    <Color x:Key="GlyphColor">#FF444444</Color>
    <!--SubmenuItem-->
    <ControlTemplate x:Key="{x:Static MenuItem.SubmenuItemTemplateKey}"
                 TargetType="{x:Type MenuItem}">
        <Border x:Name="Border"
          BorderThickness="0">
            <Grid>
                <Grid.ColumnDefinitions>
                    <ColumnDefinition Width="Auto"
                          SharedSizeGroup="Icon" />
                    <ColumnDefinition Width="*" />
                    <ColumnDefinition Width="Auto"
                          SharedSizeGroup="Shortcut" />
                    <ColumnDefinition Width="13" />
                </Grid.ColumnDefinitions>
                <!--图标-->
                <ContentPresenter x:Name="Icon" Margin="6,0,6,0" VerticalAlignment="Center" ContentSource="Icon" />
                
                <Border x:Name="Check" Width="13" Height="13" Visibility="Collapsed" Margin="6,0,6,0" BorderThickness="1">
                    <Border.BorderBrush>
                        <LinearGradientBrush StartPoint="0,0"
                               EndPoint="0,1">
                            <LinearGradientBrush.GradientStops>
                                <GradientStopCollection>
                                    <GradientStop Color="{DynamicResource BorderLightColor}"
                              Offset="0.0" />
                                    <GradientStop Color="{DynamicResource BorderDarkColor}"
                              Offset="1.0" />
                                </GradientStopCollection>
                            </LinearGradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Border.BorderBrush>
                    <Border.Background>
                        <LinearGradientBrush StartPoint="0,0"
                               EndPoint="0,1">
                            <LinearGradientBrush.GradientStops>
                                <GradientStopCollection>
                                    <GradientStop Color="{DynamicResource ControlLightColor}" />
                                    <GradientStop Color="{DynamicResource ControlMediumColor}"
                              Offset="1.0" />
                                </GradientStopCollection>
                            </LinearGradientBrush.GradientStops>
                        </LinearGradientBrush>
                    </Border.Background>
                    <Path x:Name="CheckMark"
              Width="7"
              Height="7"
              Visibility="Hidden"
              SnapsToDevicePixels="False"
              StrokeThickness="2"
              Data="M 0 0 L 7 7 M 0 7 L 7 0">
                        <Path.Stroke>
                            <SolidColorBrush Color="{DynamicResource GlyphColor}" />
                        </Path.Stroke>
                    </Path>
                </Border>
                
                <ContentPresenter x:Name="HeaderHost" Grid.Column="1" ContentSource="Header" RecognizesAccessKey="True" />
                <TextBlock x:Name="InputGestureText" Grid.Column="2" Text="{TemplateBinding InputGestureText}" Margin="5,2,0,2" DockPanel.Dock="Right" />
            </Grid>
        </Border>
        <ControlTemplate.Triggers>
            <Trigger Property="ButtonBase.Command" Value="{x:Null}" />
            <Trigger Property="Icon" Value="{x:Null}">
                <Setter TargetName="Icon"  Property="Visibility"  Value="Hidden" />
            </Trigger>
            <Trigger Property="IsChecked" Value="true">
                <Setter TargetName="CheckMark"  Property="Visibility"  Value="Visible" />
            </Trigger>
            <Trigger Property="IsCheckable" Value="true">
                <Setter TargetName="Check"  Property="Visibility"  Value="Visible" />
                <Setter TargetName="Icon"  Property="Visibility"  Value="Hidden" />
            </Trigger>
            <Trigger Property="IsHighlighted" Value="true">
                <Setter Property="Background"  TargetName="Border" Value="{StaticResource MenuItemSelectionFill}"/>
            </Trigger>
           
        </ControlTemplate.Triggers>
    </ControlTemplate>

这里中间会有一跟分割线。这要怎么去掉呢??

小林丶2013的主页 小林丶2013 | 初学一级 | 园豆:2
提问于:2013-12-13 14:20
< >
分享
所有回答(1)
0

贴也来的代码不对

 有这个线的代码不这个些,

用blend修改一下样式就行了

li-peng | 园豆:954 (小虾三级) | 2013-12-16 14:41

我就用了这些代码,谢谢你的回答,这个问题已经解决了,我只是把那个

<Border x:Name="Border"
BorderThickness="0" Background="White"> 加了一个背景颜色为白色,那根竖线就看不到了。

支持(0) 反对(0) 小林丶2013 | 园豆:2 (初学一级) | 2013-12-16 14:47
清除回答草稿
   您需要登录以后才能回答,未注册用户请先注册