MenuItem突出显示在MouseLeave之后

时间:2013-11-22 17:42:02

标签: wpf vb.net menuitem

我在组合框中有这个菜单:

<MenuItem Name="CurrencySelectMenuItem" Header="Currency" Width="Auto" 
          Background="Black" Foreground="White" BorderThickness="0" Margin="0" 
          BorderBrush="Black" VerticalAlignment="Stretch"
          HorizontalAlignment="Stretch">

当我突出显示该项目时,它会按照我想要的方式执行:它会弹出显示它的子项的方式,并突出显示它的焦点。但是,当鼠标离开时,即使单击了我的应用程序的其他部分,菜单项也会保持突出显示。

我尝试设置IsFocused属性,但它是只读的。

有人能指出我正确的方向吗?

编辑(已添加代码):

 <Grid>
<ComboBox Name="SettingsCmbx" Text="Options" Foreground="White" VerticalContentAlignment="Center" HorizontalContentAlignment="Stretch" Width="80" Style="{StaticResource blackGradientComboBox}" Margin="3">
    <ComboBox.ItemsSource>
        <CompositeCollection>
            <!--<ComboBoxItem Name="Options" IsEnabled="False" Style="{StaticResource blackComboBoxItem}">Options</ComboBoxItem>-->
            <ComboBoxItem Style="{StaticResource blackComboBoxItem}">Guidelines</ComboBoxItem>
            <ComboBoxItem Style="{StaticResource blackComboBoxItem}">Copy Investigation</ComboBoxItem>
            <MenuItem Name="CurrencySelectMenuItem" Header="Currency" Background="Black" Foreground="White" BorderThickness="0" Margin="0" BorderBrush="Black" VerticalAlignment="Stretch" HorizontalAlignment="Stretch">
                <MenuItem Name="DollarSelectMenuItem" Header="_$ - Dollar" Background="Black" Foreground="White"></MenuItem>
                <MenuItem Name="PoundSelectMenuItem" Header="_£ - Pound" Background="Black" Foreground="White"></MenuItem>
            </MenuItem>
            <ComboBoxItem Style="{StaticResource blackComboBoxItem}">About</ComboBoxItem>
        </CompositeCollection>
    </ComboBox.ItemsSource>
</ComboBox>
<TextBlock Name="OptionsTxtBlk" Text="Options" IsHitTestVisible="False" Foreground="White" VerticalAlignment="Center" HorizontalAlignment="Center"/>
 </Grid>

这是图像: enter image description here

0 个答案:

没有答案