wpf 如何设置Avalondock布局锚定窗格宽度

bttbmeg0  于 2022-11-18  发布在  其他
关注(0)|答案(1)|浏览(210)

我有一组LayoutAnchorablePaneGroup如下,

<xcad:LayoutRoot>
     <xcad:LayoutPanel Orientation="Horizontal">
                <xcad:LayoutAnchorablePaneGroup Orientation="Horizontal" >
                    <xcad:LayoutAnchorablePane  DockWidth="150">
                        <xcad:LayoutAnchorable Title="Folder" CanClose="False">
                            ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup>
                <xcad:LayoutAnchorablePaneGroup Orientation="Horizontal" >
                    <xcad:LayoutAnchorablePane DockWidth="450">
                        <xcad:LayoutAnchorable Title="Documents" CanClose="False">
                            ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup>
                <xcad:LayoutAnchorablePaneGroup Orientation="Vertical" >
                    <xcad:LayoutAnchorablePane DockWidth="200">
                        <xcad:LayoutAnchorable Title="Properties" CanClose="False">
                            ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                    <xcad:LayoutAnchorablePane >
                        <xcad:LayoutAnchorable Title="Search" CanClose="False">
                            ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup>
                <xcad:LayoutAnchorablePaneGroup Orientation="Horizontal" >
                    <xcad:LayoutAnchorablePane DockWidth="*">
                        <xcad:LayoutAnchorable Title="Viewer" CanClose="False">
                            ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup>
     </xcad:LayoutPanel>
 </xcad:LayoutRoot>

我想设置每个LayoutAnchorablePane的宽度。我试过在组级别上设置它,没有效果。
注意:我没有一个LayoutDocumentPane,如果我已经添加了LayoutDocumentPane,我可以得到正确的宽度。
任何帮助

ih99xse1

ih99xse11#

我做了一些研究,提出了GridDockPanel的解决方案

<DockPanel Grid.Row="2" FlowDirection="LeftToRight" LastChildFill="True"  SnapsToDevicePixels="True" WindowChrome.ResizeGripDirection="TopLeft" >
    <xcad:DockingManager DockPanel.Dock="Left" Grid.Row="2" BorderBrush="Black" BorderThickness="1" >
        <xcad:LayoutRoot>
            <xcad:LayoutPanel Orientation="Horizontal">
                <xcad:LayoutAnchorablePaneGroup Orientation="Horizontal" DockMinWidth="150" >
                    <xcad:LayoutAnchorablePane >
                        <xcad:LayoutAnchorable Title="Folder">
                               ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup>
                <xcad:LayoutAnchorablePaneGroup Orientation="Horizontal" DockMinWidth="450" >
                    <xcad:LayoutAnchorablePane >
                        <xcad:LayoutAnchorable Title="Documents" >
                                ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup>
                <xcad:LayoutAnchorablePaneGroup Orientation="Vertical" DockMinWidth="200" >
                    <xcad:LayoutAnchorablePane >
                        <xcad:LayoutAnchorable Title="Properties" >
                            ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                    <xcad:LayoutAnchorablePane >
                        <xcad:LayoutAnchorable Title="Search" >
                            ...
                        </xcad:LayoutAnchorable>
                    </xcad:LayoutAnchorablePane>
                </xcad:LayoutAnchorablePaneGroup> 
                </xcad:LayoutPanel>
        </xcad:LayoutRoot>

    </xcad:DockingManager>  
</DockPanel>

相关问题