Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/main'
Browse files Browse the repository at this point in the history
  • Loading branch information
kikipoulet committed Jan 21, 2025
2 parents a3b7259 + a821aeb commit e55368e
Show file tree
Hide file tree
Showing 20 changed files with 497 additions and 4 deletions.
1 change: 1 addition & 0 deletions Directory.Packages.props
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
<PackageVersion Include="AvaloniaEdit.TextMate" Version="11.1.0" />
<PackageVersion Include="CommunityToolkit.Mvvm" Version="8.3.2" />
<PackageVersion Include="Dock.Model" Version="11.2.0" />
<PackageVersion Include="Dock.Model.Mvvm" Version="11.2.0" />
<PackageVersion Include="Material.Icons.Avalonia" Version="2.1.10" />
<PackageVersion Include="Microsoft.Extensions.DependencyInjection" Version="9.0.0" />
<PackageVersion Include="ShowMeTheXaml.Avalonia" Version="1.5.1" />
Expand Down
9 changes: 9 additions & 0 deletions SukiUI.Demo/App.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
using SukiUI.Demo.Features.ControlsLibrary;
using SukiUI.Demo.Features.ControlsLibrary.Colors;
using SukiUI.Demo.Features.ControlsLibrary.Dialogs;
using SukiUI.Demo.Features.ControlsLibrary.DockControls;
using SukiUI.Demo.Features.ControlsLibrary.StackPage;
using SukiUI.Demo.Features.ControlsLibrary.TabControl;
using SukiUI.Demo.Features.ControlsLibrary.Toasts;
Expand Down Expand Up @@ -76,6 +77,7 @@ private static SukiViews ConfigureViews(ServiceCollection services)
.AddView<CollectionsView, CollectionsViewModel>(services)
.AddView<ContextMenusView, ContextMenusViewModel>(services)
.AddView<DockView, DockViewModel>(services)
.AddView<DockMvvmView, DockMvvmViewModel>(services)
.AddView<ExpanderView, ExpanderViewModel>(services)
.AddView<IconsView, IconsViewModel>(services)
.AddView<InfoBarView, InfoBarViewModel>(services)
Expand All @@ -91,6 +93,13 @@ private static SukiViews ConfigureViews(ServiceCollection services)
.AddView<ColorsView, ColorsViewModel>(services)
.AddView<ExperimentalView, ExperimentalViewModel>(services)

// Add docks view for DockMvvvm
.AddView<DocumentText, DocumentTextViewModel>(services)
.AddView<ErrorList, ErrorListViewModel>(services)
.AddView<OutputView, OutputViewModel>(services)
.AddView<PropertiesView, PropertiesViewModel>(services)
.AddView<SolutionExplore, SolutionExploreViewModel>(services)

// Add additional views
.AddView<DialogView, DialogViewModel>(services)
.AddView<VmDialogView, VmDialogViewModel>(services)
Expand Down
167 changes: 167 additions & 0 deletions SukiUI.Demo/Features/ControlsLibrary/DockControls/DockFactory.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,167 @@
using Dock.Avalonia.Controls;
using Dock.Model.Avalonia;
using Dock.Model.Controls;
using Dock.Model.Core;
using Dock.Model.Mvvm.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public class DockFactory(object context) : Factory
{
private readonly object _context = context;
private IRootDock? _rootDock;
private IDocumentDock? _documentDock;

public override IRootDock CreateLayout()
{
var programDocument = new DocumentTextViewModel()
{ Id = "DocumentText", Title = "Program.cs" };
var appDocument = new DocumentTextViewModel()
{ Id = "DocumentText", Title = "App.axaml" };

var errorListTool = new ErrorListViewModel()
{ Id = "ErrorListTool", Title = "Error List" };
var outputTool = new OutputViewModel()
{ Id = "OutputTool", Title = "Output" };
var propertiesTool = new PropertiesViewModel() { Id = "PropertiesTool", Title = "Properties" };
var solutionExploreTool = new SolutionExploreViewModel() { Id = "SolutionExploreTool", Title = "Solution Explore" };

var leftDock = new ProportionalDock
{
Proportion = 0.25,
Orientation = Orientation.Vertical,
ActiveDockable = null,
VisibleDockables = CreateList<IDockable>
(
new ToolDock
{
ActiveDockable = solutionExploreTool,
VisibleDockables = CreateList<IDockable>(solutionExploreTool),
Alignment = Alignment.Left
}
)
};

var documentDock = new DocumentDock
{
Proportion = 0.7,
IsCollapsable = false,
ActiveDockable = programDocument,
VisibleDockables = CreateList<IDockable>(programDocument, appDocument),
CanCreateDocument = true
};

var rightTopDock = new ProportionalDock
{
Proportion = 0.70,
Orientation = Orientation.Horizontal,
ActiveDockable = null,
VisibleDockables = CreateList<IDockable>
(
documentDock,
new ProportionalDockSplitter(),
new ToolDock
{
ActiveDockable = propertiesTool,
VisibleDockables = CreateList<IDockable>(propertiesTool),
Alignment = Alignment.Top,
}
)
};

var rightBottomDock = new ProportionalDock
{
Proportion = 0.30,
Orientation = Orientation.Horizontal,
ActiveDockable = null,
VisibleDockables = CreateList<IDockable>
(
new ToolDock
{
ActiveDockable = outputTool,
VisibleDockables = CreateList<IDockable>(errorListTool, outputTool),
Alignment = Alignment.Top,
}
)
};

var rightDock = new ProportionalDock
{
Proportion = 0.75,
Orientation = Orientation.Vertical,
ActiveDockable = null,
VisibleDockables = CreateList<IDockable>
(
rightTopDock,
new ProportionalDockSplitter(),
rightBottomDock
)
};

var mainLayout = new ProportionalDock
{
Orientation = Orientation.Horizontal,
VisibleDockables = CreateList<IDockable>
(
leftDock,
new ProportionalDockSplitter(),
rightDock
)
};

var homeView = new HomeViewModel
{
Id = "Home",
Title = "Home",
ActiveDockable = mainLayout,
VisibleDockables = CreateList<IDockable>(mainLayout)
};

var rootDock = CreateRootDock();

rootDock.IsCollapsable = false;
rootDock.ActiveDockable = homeView;
rootDock.DefaultDockable = homeView;
rootDock.VisibleDockables = CreateList<IDockable>(homeView);

_documentDock = documentDock;
_rootDock = rootDock;

return rootDock;
}

public override IDockWindow? CreateWindowFrom(IDockable dockable)
{
var window = base.CreateWindowFrom(dockable);

if (window != null)
{
window.Title = "Dock Avalonia Demo";
}

return window;
}

public override void InitLayout(IDockable layout)
{
ContextLocator = new Dictionary<string, Func<object?>>
{
["Dashboard"] = () => layout,
["Home"] = () => _context
};

DockableLocator = new Dictionary<string, Func<IDockable?>>()
{
["Root"] = () => _rootDock,
["Documents"] = () => _documentDock
};

HostWindowLocator = new Dictionary<string, Func<IHostWindow?>>
{
[nameof(IDockWindow)] = () => new HostWindow()
};

base.InitLayout(layout);
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Dock.Model.Mvvm.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public class DocumentTextViewModel : Document
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@

using Dock.Model.Mvvm.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public class ErrorListViewModel : Tool
{

}
}
20 changes: 20 additions & 0 deletions SukiUI.Demo/Features/ControlsLibrary/DockControls/HomeView.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
<UserControl xmlns="https://github.com/avaloniaui"
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:dockControls="clr-namespace:SukiUI.Demo.Features.ControlsLibrary.DockControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="dockControls:HomeViewModel"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.HomeView">
<Grid
RowDefinitions="*,25">
<ContentControl
Content="{Binding ActiveDockable}"
Margin="4"
Grid.Row="0"/>
<TextBlock
Text="{Binding FocusedDockable}"
Margin="4"
Grid.Row="1"/>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public partial class propertiesview : UserControl
public partial class HomeView : UserControl
{
public propertiesview()
public HomeView()
{
InitializeComponent();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Dock.Model.Mvvm.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public class HomeViewModel : RootDock
{

}
}
23 changes: 23 additions & 0 deletions SukiUI.Demo/Features/ControlsLibrary/DockControls/OutputView.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
<UserControl xmlns="https://github.com/avaloniaui"
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:dockControls="clr-namespace:SukiUI.Demo.Features.ControlsLibrary.DockControls"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="dockControls:OutputViewModel"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.OutputView">
<TextBlock HorizontalAlignment="Left" Margin="15,12" FontSize="13" Foreground="{DynamicResource SukiLowText}" >
Build: Dock.Model.Avalonia.Controls.Tool, Id='SolutionExplorer'<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run>SolutionExplorer, Dock.Avalonia.Controls.ToolContentControl<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run> Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers+PointerDeferredContent`1[Avalonia.Controls.Control], DockXamlSample.SolutionExplore<LineBreak></LineBreak>
Build: Dock.Model.Avalonia.Controls.Document, Id='Document1'<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run> Document1, Dock.Avalonia.Controls.DocumentContentControl<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run> Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers+PointerDeferredContent`1[Avalonia.Controls.Control], Avalonia.Controls.TextBlock<LineBreak></LineBreak>
Build: Dock.Model.Avalonia.Controls.Tool, Id='Properties'<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run> Properties, Dock.Avalonia.Controls.ToolContentControl<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run> Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers+PointerDeferredContent`1[Avalonia.Controls.Control], DockXamlSample.propertiesview<LineBreak></LineBreak>
Build: Dock.Model.Avalonia.Controls.Tool, Id='Output'<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run> Output, Dock.Avalonia.Controls.ToolContentControl<LineBreak></LineBreak>
<Run Foreground="Green"> [Added] </Run> Avalonia.Markup.Xaml.XamlIl.Runtime.XamlIlRuntimeHelpers+PointerDeferredContent`1[Avalonia.Controls.Control], Avalonia.Controls.TextBlock<LineBreak></LineBreak>
</TextBlock>
</UserControl>
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
using Avalonia;
using Avalonia.Controls;
using Avalonia.Markup.Xaml;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public partial class OutputView : UserControl
{
public OutputView()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Dock.Model.Mvvm.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public class OutputViewModel : Tool
{

}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:suki="https://github.com/kikipoulet/SukiUI"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.propertiesview">
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockControls.PropertiesView">
<StackPanel Margin="15,25,15,0" >
<Expander Header="Window Informations" IsExpanded="True">
<StackPanel Margin="25,0" Spacing="10">
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Avalonia.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public partial class PropertiesView : UserControl
{
public PropertiesView()
{
InitializeComponent();
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Dock.Model.Mvvm.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public class PropertiesViewModel : Tool
{

}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
using Dock.Model.Mvvm.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary.DockControls
{
public class SolutionExploreViewModel : Tool
{

}
}
13 changes: 13 additions & 0 deletions SukiUI.Demo/Features/ControlsLibrary/DockMvvmView.axaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
<UserControl xmlns="https://github.com/avaloniaui"
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:controlsLibrary="clr-namespace:SukiUI.Demo.Features.ControlsLibrary"
mc:Ignorable="d" d:DesignWidth="800" d:DesignHeight="450"
x:DataType="controlsLibrary:DockMvvmViewModel"
x:Class="SukiUI.Demo.Features.ControlsLibrary.DockMvvmView">
<DockControl
x:Name="DockControl"
Layout="{Binding Layout}"
Margin="4"/>
</UserControl>
12 changes: 12 additions & 0 deletions SukiUI.Demo/Features/ControlsLibrary/DockMvvmView.axaml.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
using Avalonia.Controls;

namespace SukiUI.Demo.Features.ControlsLibrary
{
public partial class DockMvvmView : UserControl
{
public DockMvvmView()
{
InitializeComponent();
}
}
}
Loading

0 comments on commit e55368e

Please sign in to comment.