如何在 AvalonDock 2(LayoutDocumentPane) 中禁用左、右、上、下放置目标
How to disable left, right, top and bottom drop targets in AvalonDock 2(LayoutDocumentPane)
我正在尝试禁用除 avalon dock 中的中心目标之外的投放目标。在 codeplex 中找不到任何文档来执行此操作。我在 Whosebug here 中发现了一个类似的问题,但没有正确的答案,所以再次询问。
作为一个选项,您可以覆盖 OverlayWindow 控件样式并从中删除或更改拖放区域:
<Style x:Key="{x:Type avalonDockControls:OverlayWindow}"
TargetType="{x:Type avalonDockControls:OverlayWindow}">
...
<Grid x:Name="PART_AnchorablePaneDropTargets">
<Grid Width="88"
Height="88"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Grid.ColumnSpan="3"
Grid.RowSpan="3"
Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/DockPaneEmpty.PNG"
Stretch="Uniform">
</Image>
<Border Name="PART_AnchorablePaneDropTargetTop"
Grid.Column="1"
Grid.Row="0">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneTop.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetRight"
Grid.Column="2"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneRight.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetBottom"
Grid.Column="1"
Grid.Row="2">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneBottom.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetLeft"
Grid.Column="0"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneLeft.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetInto"
Grid.Column="1"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneInside.png"
Stretch="None">
</Image>
</Border>
</Grid>
</Grid>
<Grid x:Name="PART_DocumentPaneDropTargets">
<Grid Width="88"
Height="88"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Grid.ColumnSpan="3"
Grid.RowSpan="3"
Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/DockPaneEmpty.PNG"
Stretch="Uniform">
</Image>
<Border Name="PART_DocumentPaneDropTargetTop"
Grid.Column="1"
Grid.Row="0">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneTop.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetRight"
Grid.Column="2"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneRight.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetBottom"
Grid.Column="1"
Grid.Row="2">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneBottom.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetLeft"
Grid.Column="0"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneLeft.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetInto"
Grid.Column="1"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneInside.png"
Stretch="None">
</Image>
</Border>
</Grid>
</Grid>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
您需要更改的元素的名称中包含 "DropTarget"。
完整版样式在这里:https://github.com/xceedsoftware/wpftoolkit/blob/master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Themes/generic.xaml 从第 479 行开始。
我正在尝试禁用除 avalon dock 中的中心目标之外的投放目标。在 codeplex 中找不到任何文档来执行此操作。我在 Whosebug here 中发现了一个类似的问题,但没有正确的答案,所以再次询问。
作为一个选项,您可以覆盖 OverlayWindow 控件样式并从中删除或更改拖放区域:
<Style x:Key="{x:Type avalonDockControls:OverlayWindow}"
TargetType="{x:Type avalonDockControls:OverlayWindow}">
...
<Grid x:Name="PART_AnchorablePaneDropTargets">
<Grid Width="88"
Height="88"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Grid.ColumnSpan="3"
Grid.RowSpan="3"
Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/DockPaneEmpty.PNG"
Stretch="Uniform">
</Image>
<Border Name="PART_AnchorablePaneDropTargetTop"
Grid.Column="1"
Grid.Row="0">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneTop.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetRight"
Grid.Column="2"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneRight.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetBottom"
Grid.Column="1"
Grid.Row="2">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneBottom.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetLeft"
Grid.Column="0"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneLeft.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_AnchorablePaneDropTargetInto"
Grid.Column="1"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneInside.png"
Stretch="None">
</Image>
</Border>
</Grid>
</Grid>
<Grid x:Name="PART_DocumentPaneDropTargets">
<Grid Width="88"
Height="88"
VerticalAlignment="Center"
HorizontalAlignment="Center">
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<Image Grid.ColumnSpan="3"
Grid.RowSpan="3"
Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/DockPaneEmpty.PNG"
Stretch="Uniform">
</Image>
<Border Name="PART_DocumentPaneDropTargetTop"
Grid.Column="1"
Grid.Row="0">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneTop.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetRight"
Grid.Column="2"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneRight.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetBottom"
Grid.Column="1"
Grid.Row="2">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneBottom.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetLeft"
Grid.Column="0"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockDocPaneLeft.png"
Stretch="None">
</Image>
</Border>
<Border Name="PART_DocumentPaneDropTargetInto"
Grid.Column="1"
Grid.Row="1">
<Image Source="/Xceed.Wpf.AvalonDock;component/Themes/Generic/Images/InnerDockPaneInside.png"
Stretch="None">
</Image>
</Border>
</Grid>
</Grid>
</Canvas>
</ControlTemplate>
</Setter.Value>
</Setter>
您需要更改的元素的名称中包含 "DropTarget"。 完整版样式在这里:https://github.com/xceedsoftware/wpftoolkit/blob/master/ExtendedWPFToolkitSolution/Src/Xceed.Wpf.AvalonDock/Themes/generic.xaml 从第 479 行开始。