C# 我可以自定义AvalonDock关联菜单吗?

C# 我可以自定义AvalonDock关联菜单吗?,c#,wpf,contextmenu,dock,avalondock,C#,Wpf,Contextmenu,Dock,Avalondock,我在一个项目中使用AvalonDock来利用工具窗口 我不需要选项卡式文档,当我右键单击工具窗口标题栏时,我想禁用“Dock as Tabbed Document”上下文菜单项。这可能吗 谢谢我认为这是一个简单的属性设置。 我使用来自codeplex 76560的最新源代码 可以将DockableStyle特性更改为所需的样式: <ad:SampleDockableContent DockableStyle="DockableToBorders" x

我在一个项目中使用AvalonDock来利用工具窗口

我不需要选项卡式文档,当我右键单击工具窗口标题栏时,我想禁用“Dock as Tabbed Document”上下文菜单项。这可能吗


谢谢

我认为这是一个简单的属性设置。 我使用来自codeplex 76560的最新源代码

可以将DockableStyle特性更改为所需的样式:

<ad:SampleDockableContent DockableStyle="DockableToBorders"
                    x:Name="DockingManagerPropertiesHost"
                    Title="Only dock to borders">
</ad:SampleDockableContent>
以下是标志枚举:

/// <summary>
/// Defines how a dockable content can be dragged over a docking manager
/// </summary>
/// <remarks>This style can be composed with the 'or' operator.</remarks>
public enum DockableStyle : uint
{ 
    /// <summary>
    /// Content is not dockable at all
    /// </summary>
    None = 0x0000,

    /// <summary>
    /// Dockable as document
    /// </summary>
    Document    = 0x0001,

    /// <summary>
    /// Dockable to the left border of <see cref="DockingManager"/>
    /// </summary>
    LeftBorder  = 0x0002,

    /// <summary>
    /// Dockable to the right border of <see cref="DockingManager"/>
    /// </summary>
    RightBorder = 0x0004,

    /// <summary>
    /// Dockable to the top border of <see cref="DockingManager"/>
    /// </summary>
    TopBorder   = 0x0008,

    /// <summary>
    /// Dockable to the bottom border of <see cref="DockingManager"/>
    /// </summary>
    BottomBorder= 0x0010,

    /// <summary>
    /// A <see cref="DockableContent"/> with this style can be hosted in a <see cref="FloatingWindow"/>
    /// </summary>
    Floating = 0x0020,

    /// <summary>
    /// A <see cref="DockableContent"/> with this style can be the only one content in a <see cref="DockablePane"/> pane (NOT YET SUPPORTED)
    /// </summary>
    /// <remarks>This style is not compatible with <see cref="DockableStyle.Document"/> style</remarks>
    Single = 0x0040,

    /// <summary>
    /// A <see cref="DockableContet"/> with this style can be autohidden.
    /// </summary>
    AutoHide = 0x0080,

    /// <summary>
    /// Dockable only to a border of a <see cref="DockingManager"/>
    /// </summary>
    DockableToBorders = LeftBorder | RightBorder | TopBorder | BottomBorder | AutoHide,

    /// <summary>
    /// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/>
    /// </summary>
    Dockable = DockableToBorders | Document | Floating,

    /// <summary>
    /// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/> but not in autohidden mode (WinForms controls)
    /// </summary>
    DockableButNotAutoHidden = Dockable & ~AutoHide
}
//
///定义如何在停靠管理器上拖动可停靠内容
/// 
///此样式可以由“或”运算符组成。
公共枚举停靠样式:uint
{ 
/// 
///内容根本不可停靠
/// 
无=0x0000,
/// 
///可作为文件固定
/// 
文档=0x0001,
/// 
///可停靠到的左侧边界
/// 
LeftBorder=0x0002,
/// 
///可停靠在的右边界上
/// 
RightBorder=0x0004,
/// 
///可停靠到
/// 
TopBorder=0x0008,
/// 
///可停靠到
/// 
BottomBorder=0x0010,
/// 
///具有此样式的可以托管在中
/// 
浮动=0x0020,
/// 
///具有此样式的内容可以是窗格中的唯一内容(尚不支持)
/// 
///此样式与样式不兼容
单个=0x0040,
/// 
///具有此样式的文件可以自动隐藏。
/// 
自动隐藏=0x0080,
/// 
///只能停靠在一个边界上
/// 
可停靠Borders=左边框|右边框|上边框|下边框|自动隐藏,
/// 
///可停靠在a的边界上并进入a
/// 
可停靠=可停靠订单|文档|浮动,
/// 
///可停靠到的边框和中,但不处于自动隐藏模式(WinForms控件)
/// 
DockableButNotAutoHidden=可停靠&~AutoHide
}

非常感谢,我成功地禁用了“Dock as tabbed document”功能。您知道我是否也可以删除项目并更改上下文菜单中显示的名称吗?在浮动模式下,我发现了几个错误,但发现DockableContent的ContextMenu属性始终为null。
/// <summary>
/// Defines how a dockable content can be dragged over a docking manager
/// </summary>
/// <remarks>This style can be composed with the 'or' operator.</remarks>
public enum DockableStyle : uint
{ 
    /// <summary>
    /// Content is not dockable at all
    /// </summary>
    None = 0x0000,

    /// <summary>
    /// Dockable as document
    /// </summary>
    Document    = 0x0001,

    /// <summary>
    /// Dockable to the left border of <see cref="DockingManager"/>
    /// </summary>
    LeftBorder  = 0x0002,

    /// <summary>
    /// Dockable to the right border of <see cref="DockingManager"/>
    /// </summary>
    RightBorder = 0x0004,

    /// <summary>
    /// Dockable to the top border of <see cref="DockingManager"/>
    /// </summary>
    TopBorder   = 0x0008,

    /// <summary>
    /// Dockable to the bottom border of <see cref="DockingManager"/>
    /// </summary>
    BottomBorder= 0x0010,

    /// <summary>
    /// A <see cref="DockableContent"/> with this style can be hosted in a <see cref="FloatingWindow"/>
    /// </summary>
    Floating = 0x0020,

    /// <summary>
    /// A <see cref="DockableContent"/> with this style can be the only one content in a <see cref="DockablePane"/> pane (NOT YET SUPPORTED)
    /// </summary>
    /// <remarks>This style is not compatible with <see cref="DockableStyle.Document"/> style</remarks>
    Single = 0x0040,

    /// <summary>
    /// A <see cref="DockableContet"/> with this style can be autohidden.
    /// </summary>
    AutoHide = 0x0080,

    /// <summary>
    /// Dockable only to a border of a <see cref="DockingManager"/>
    /// </summary>
    DockableToBorders = LeftBorder | RightBorder | TopBorder | BottomBorder | AutoHide,

    /// <summary>
    /// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/>
    /// </summary>
    Dockable = DockableToBorders | Document | Floating,

    /// <summary>
    /// Dockable to a border of a <see cref="DockingManager"/> and into a <see cref="DocumentPane"/> but not in autohidden mode (WinForms controls)
    /// </summary>
    DockableButNotAutoHidden = Dockable & ~AutoHide
}