赞
踩
- <Style TargetType="{x:Type Menu}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type Menu}">
- <Border CornerRadius="0">
- <ItemsPresenter/>
- </Border>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
-
- <Style TargetType="{x:Type MenuItem}">
- <Setter Property="Template">
- <Setter.Value>
- <ControlTemplate TargetType="{x:Type MenuItem}">
- <Border Margin="0,2" x:Name="bd" Background="#CCCCCC" MinWidth="100" CornerRadius="0">
- <Grid>
- <Grid.ColumnDefinitions>
- <ColumnDefinition Width="30"/>
- <ColumnDefinition/>
- </Grid.ColumnDefinitions>
- <Rectangle Fill="#99CC66" Height="20" Width="20"/>
- <ContentPresenter Margin="0,10" ContentSource="Header" Grid.Column="1" HorizontalAlignment="Left"/>
- <Popup x:Name="pop" Margin="10" IsOpen="{TemplateBinding IsSubmenuOpen}" AllowsTransparency="True" Placement="Right">
- <Border Margin="5" CornerRadius="5" Background="#FFCCCC">
- <StackPanel IsItemsHost="True">
- </StackPanel>
- </Border>
- </Popup>
- </Grid>
- </Border>
- <ControlTemplate.Triggers>
- <Trigger Property="IsMouseOver" Value="true">
- <Setter TargetName="bd" Property="Background" Value="#0099CC"/>
- <Setter TargetName="pop" Property="IsOpen" Value="true"/>
- </Trigger>
- <Trigger Property="IsMouseOver" Value="False">
- <Setter TargetName="pop" Property="IsOpen" Value="false"/>
- </Trigger>
- <Trigger Property="IsPressed" Value="True">
- <Setter TargetName="bd" Property="Background" Value="#FF6666"/>
- <Setter TargetName="pop" Property="IsOpen" Value="false"/>
- </Trigger>
- </ControlTemplate.Triggers>
- </ControlTemplate>
- </Setter.Value>
- </Setter>
- </Style>
- <StackPanel Width="100" HorizontalAlignment="Left">
- <Menu>
- <MenuItem Header="开始">
- <MenuItem Header="开始"></MenuItem>
- <MenuItem Header="开始"></MenuItem>
- <MenuItem Header="开始"></MenuItem>
- <MenuItem Header="开始"></MenuItem>
- </MenuItem>
- </Menu>
- <Menu>
- <MenuItem Header="哈哈">
- <MenuItem Header="哈哈"></MenuItem>
- <MenuItem Header="哈哈"></MenuItem>
- <MenuItem Header="哈哈"></MenuItem>
- <MenuItem Header="哈哈"></MenuItem>
- </MenuItem>
- </Menu>
- <Menu>
- <MenuItem Header="哦哦">
- <MenuItem Header="好看啦啦啦"></MenuItem>
- <MenuItem Header="啦啦啦"></MenuItem>
- <MenuItem Header="啦啦啦"></MenuItem>
- <MenuItem Header="啦啦啦"></MenuItem>
- </MenuItem>
- </Menu>
- </StackPanel>
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。