Home > Mobile >  Wpf app with AvalonDock docking layout system
Wpf app with AvalonDock docking layout system

Time:11-30

I am creating a small wpf program in .net5. It should have a tab system and a sidebar. The Dirkster.AvalonDock library github is suitable for my purposes. Installed version 4.60.0. I just started getting to know this library. The difficulty arose with the sidebar. LayoutAnchorablePane is responsible for its output. But the result is not what I expect.
I need to get something like this
img1
There is now
img2
View code:

    <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>

The viewmodel code is not important, I think. Also installed in the project is caliburn.micro
Please tell me how to get the sidebar as in the first picture.

CodePudding user response:

You have to install VS2013 theme package (link) then use the light version like the following:

<DockingManager.Theme> 
    <Vs2013LightTheme /> 
</DockingManager.Theme> 
  • Related