我无法为LayoutAnchorablePanes禁用浮动。我的xaml看起来像这样
<DockPanel>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<Grid>
<avalonDock:DockingManager x:Name="dockManager">
<avalonDock:LayoutRoot>
<avalonDock:LayoutPanel>
<avalonDock:LayoutAnchorablePaneGroup DockWidth="420"
Orientation="Vertical">
<avalonDock:LayoutAnchorablePane >
<avalonDock:LayoutAnchorable Title="Main"
CanClose="False"
CanHide="False"
CanFloat="False"
ContentId="1">
//Some Content here...
</avalonDock:LayoutAnchorable>
</avalonDock:LayoutAnchorablePane>
</avalonDock:LayoutAnchorablePaneGroup>
</avalonDock:LayoutPanel>
</avalonDock:LayoutRoot>
</avalonDock:DockingManager>
</Grid>
</ScrollViewer>
</DockPanel>
我的问题是即使将CanFloat属性设置为false,我也可以浮动窗口。有人知道我做错了吗?
答案 0 :(得分:0)
只需尝试创建新的测试解决方案。我用你上面发布的代码做了,我无法浮动那个窗口:
<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:avalonDock="http://schemas.xceed.com/wpf/xaml/avalondock"
Title="MainWindow" Height="350" Width="525">
<DockPanel>
<ScrollViewer HorizontalScrollBarVisibility="Disabled">
<Grid>
<avalonDock:DockingManager x:Name="dockManager">
<avalonDock:LayoutRoot>
<avalonDock:LayoutPanel>
<avalonDock:LayoutAnchorablePaneGroup DockWidth="420" Orientation="Vertical">
<avalonDock:LayoutAnchorablePane >
<avalonDock:LayoutAnchorable Title="Main"
CanClose="False"
CanHide="False"
CanFloat="False"
ContentId="1">
</avalonDock:LayoutAnchorable>
</avalonDock:LayoutAnchorablePane>
</avalonDock:LayoutAnchorablePaneGroup>
</avalonDock:LayoutPanel>
</avalonDock:LayoutRoot>
</avalonDock:DockingManager>
</Grid>
</ScrollViewer>
</DockPanel>
</Window>
尝试一下,然后添加代码的下一个块以找出问题所在......