gpt4 book ai didi

c# - RibbonControlsLibrary - 如何禁用最小化?

转载 作者:行者123 更新时间:2023-11-30 16:27:58 24 4
gpt4 key购买 nike

如何禁用 RibbonControlsLibrary 中功能区控件的最小化?

最佳答案

以下代码禁用了双击选项卡标题和上下文菜单中的“最小化功能区”功能:

public class ExRibbon : Ribbon
{
public override void OnApplyTemplate()
{
base.OnApplyTemplate();

IsMinimizedProperty.OverrideMetadata(typeof(ExRibbon),
new FrameworkPropertyMetadata(false, (o, e) => { }, (o, e) => false));

Type ownerType = typeof(ExRibbon);
CommandManager.RegisterClassCommandBinding(ownerType,
new CommandBinding(RibbonCommands.MinimizeRibbonCommand, null, MinimizeRibbonCanExecute));
}

private static void MinimizeRibbonCanExecute(object sender, CanExecuteRoutedEventArgs args)
{
args.CanExecute = false;
args.Handled = true;
}
}

关于c# - RibbonControlsLibrary - 如何禁用最小化?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/7412853/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com