首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >带有AvalonDock对接布局系统的Wpf应用程序

带有AvalonDock对接布局系统的Wpf应用程序
EN

Stack Overflow用户
提问于 2021-11-26 20:21:03
回答 1查看 198关注 0票数 0

我正在.net5中创建一个小的wpf程序。它应该有一个制表符系统和一个侧栏。Dirkster.AvalonDock库github适合于我的目的。已安装4.60.0版。我刚开始了解这个图书馆。侧边栏出现了困难。LayoutAnchorablePane负责其输出。但结果并不如我所料。

我需要这样的东西

img1

现在有

img2

查看代码:

代码语言:javascript
复制
    <Window x:Class="TestApp.Views.MainWindowView"
    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
    xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
    xmlns:vm="clr-namespace:TestApp.ViewModels"
    xmlns:cm="http://www.caliburnproject.org"
    mc:Ignorable="d"
    Width="800" Height="450"
    Title="MainWindow">
<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="Auto"/>
    </Grid.ColumnDefinitions>
    <DockingManager x:Name="DockManager" Grid.Column="0"
                DocumentsSource="{Binding Items}"
                AnchorablesSource="{Binding MenuItems}"
                >
        <DockingManager.LayoutItemTemplate>
            <DataTemplate>
                <ContentControl cm:View.Model="{Binding Content}" IsTabStop="False" />
            </DataTemplate>
        </DockingManager.LayoutItemTemplate>
        <DockingManager.LayoutItemContainerStyle>
            <Style TargetType="{x:Type LayoutItem}">
                <Setter Property="Title" Value="{Binding Model.DisplayName, Mode=OneWay}"/>
                <Setter Property="CloseCommand" Value="{Binding Model.CloseCommand}"/>
            </Style>
        </DockingManager.LayoutItemContainerStyle>
        <LayoutRoot>
            <LayoutPanel>
                <LayoutDocumentPaneGroup>
                    <LayoutDocumentPane />
                </LayoutDocumentPaneGroup>
                <LayoutAnchorablePaneGroup>
                    <LayoutAnchorablePane DockMinWidth="300" />
                </LayoutAnchorablePaneGroup>
            </LayoutPanel>
        </LayoutRoot>
    </DockingManager>
</Grid>

我认为视图模型代码并不重要。项目中还安装了caliburn.micro。

请告诉我如何获得第一张图片中的侧边栏。

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2021-11-28 18:00:23

您必须安装VS2013主题包(链接),然后使用轻量级版本,如下所示:

代码语言:javascript
复制
<DockingManager.Theme> 
    <Vs2013LightTheme /> 
</DockingManager.Theme> 
票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/70129685

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档