WPF功能区AuxiliaryPaneContent隐藏或折叠

时间:2014-01-05 12:39:45

标签: c# wpf ribbon ribbon-control

我正在使用功能区进行我的WPF应用检查link >>

我想隐藏/折叠区域名为AuxiliaryPaneContent - 请查看此屏幕截图:

enter image description here

我读到我需要通过风格来做,但我不知道如何。

这是我的代码:

<r:Ribbon.ApplicationMenu>                
    <r:RibbonApplicationMenu Visibility="Visible" >
        <r:RibbonApplicationMenu.AuxiliaryPaneContent>
            <!-- STYLE SHOULD BE PROBABLY HERE -->
        </r:RibbonApplicationMenu.AuxiliaryPaneContent>

        <r:RibbonApplicationMenuItem 
                              Header="Item1"                                          
                              Click="ExitClick"
                              IsEnabled="True"
                              KeyTip="O" />
        <r:RibbonApplicationMenuItem 
                              Header="Item2"                                          
                              Click="MyClick"
                              IsEnabled="True"
                              KeyTip="O" />
    </r:RibbonApplicationMenu>                
</r:Ribbon.ApplicationMenu>

感谢您的帮助。

1 个答案:

答案 0 :(得分:6)

这对我有用。只需确保在

中调用它
RibbonWindow_Loaded(object sender, RoutedEventArgs e)
        {
             var grid = (_ribbonApplicationMenu.Template.FindName("MainPaneBorder",_ribbonApplicationMenu) as Border).Parent as Grid;
             grid.ColumnDefinitions[2].Width = new GridLength(0);
        }