我在XAML的弹出窗口中创建了MenuItems。该菜单项包含SubMenu项。单击切换按钮时弹出窗口。我无法在弹出窗口中打开MenuItem的子MenuItem。
$
<ToggleButton Name="button"
Width="30"
Height="30"
Click="Button_Click">
<Image Width="30" Height="30">
<Image.Source>
<BitmapImage UriSource="/WpfApplication4;component/Images/Filter.png" />
</Image.Source>
</Image>
</ToggleButton>
<Popup Name="PART_Popup"
Placement="Bottom"
PlacementTarget="{Binding ElementName=button}">
<Border Background="White"
BorderBrush="Gray"
BorderThickness="1">
<StackPanel Orientation="Vertical">
<MenuItem Width="270"
Margin="5"
Header="ClearFilter">
<MenuItem.Icon>
<Image>
<Image.Source>
<BitmapImage UriSource="/WpfApplication4;component/Images/ClearFilter.png" />
</Image.Source>
</Image>
</MenuItem.Icon>
<MenuItem Header="SubMenu" />
<MenuItem Header="SubMenu1" />
</MenuItem>
</StackPanel>
</Border>
</Popup>
请帮我解决这个问题。
答案 0 :(得分:2)
将MenuItem
包裹在Menu
中,它会起作用。