0
我正在创建一个与视觉工作室撤消按钮相同的撤消按钮。我希望用户能够将鼠标悬停在项目上方,并选择其上方的每个项目。点击上面的所有项目都会被传入并执行操作。如果用户自己单击按钮,则撤消顶部对象。问题:没有使用上下文菜单,也不知道我在用wpf做什么。现在用户可以将鼠标悬停在上面,但只有鼠标在上面的对象被选中(所有后面的代码都是vb.net)。所有帮助表示赞赏!菜单中的MutliSelect列表框
代码:
<MenuItem Header="Undo" Name="MenuUndo" IsEnabled="True">
<MenuItem.Icon>
<Image Source="Undo.png" Width="24" Height="24" />
</MenuItem.Icon>
<StackPanel>
<ListBox Name="ListBoxUndo" HorizontalAlignment="Stretch "
VerticalAlignment="Stretch" Width="177" Height="100 " Margin="-33,-5,-65,-5"
ScrollViewer.VerticalScrollBarVisibility="Visible" IsEnabled="True"
SelectionMode ="Multiple">
<ListBox.ItemContainerStyle>
<Style TargetType="ListBoxItem">
<Style.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter Property="IsSelected" Value="True"/>
</Trigger>
</Style.Triggers>
</Style>
</ListBox.ItemContainerStyle>
</ListBox>
</StackPanel>
</MenuItem>