答案 0 :(得分:1)
您可以在Loaded事件的代码后面执行此操作。 加载= “Ribbon_OnLoaded”
private void Ribbon_OnLoaded(object sender, RoutedEventArgs e)
{
int childControlCount = VisualTreeHelper.GetChildrenCount((System.Windows.Controls.Ribbon.Ribbon)sender);
if (childControlCount != 0)
{
for (int i = 0;
i < VisualTreeHelper.GetChildrenCount((System.Windows.Controls.Ribbon.Ribbon)sender);
i++)
{
DependencyObject child = VisualTreeHelper.GetChild((System.Windows.Controls.Ribbon.Ribbon)sender, i);
if (child is Grid)
{
((Grid)child).RowDefinitions[0].Height = new GridLength(0);
}
}
}
}
答案 1 :(得分:0)
内容需要托管在RibbonWindow
内。