2012-06-28 67 views
2

我已經創建了MenuItems在XAML的彈出窗口中。該菜單項包含SubMenu項目。點擊切換按鈕打開彈出窗口。我不能打開彈出菜單中MenuItem的子菜單項。WPF彈出窗口中的子菜單項

$

<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> 

請幫我解決這個問題。

回答

2

MenuItem包裝在Menu,它會工作。