Skip to content

Commit

Permalink
Merge branch 'master' into fix-close
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes authored Mar 11, 2024
2 parents 9f2dfeb + b77793f commit aeed334
Show file tree
Hide file tree
Showing 17 changed files with 238 additions and 320 deletions.
6 changes: 3 additions & 3 deletions samples/DockMvvmSample/Views/ProportionalStackPanelView.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@
<TabControl>
<TabItem Header="Default">
<ProportionalStackPanel Orientation="Horizontal">
<ProportionalStackPanel ProportionalStackPanelSplitter.Proportion="0.5">
<Rectangle Fill="Red" ProportionalStackPanelSplitter.Proportion="0.5" />
<ProportionalStackPanel ProportionalStackPanel.Proportion="0.5">
<Rectangle Fill="Red" ProportionalStackPanel.Proportion="0.5" />
<ProportionalStackPanelSplitter />
<Rectangle Fill="Green" />
<ProportionalStackPanelSplitter />
Expand All @@ -35,7 +35,7 @@
<ProportionalStackPanelSplitter />
<Rectangle Fill="Blue" />
<ProportionalStackPanelSplitter />
<Rectangle Fill="Red" ProportionalStackPanelSplitter.Proportion="0.5" />
<Rectangle Fill="Red" ProportionalStackPanel.Proportion="0.5" />
</ProportionalStackPanel>
</ProportionalStackPanel>
</TabItem>
Expand Down
3 changes: 0 additions & 3 deletions src/Dock.Avalonia/Controls/DockDockControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,6 @@

<ControlTheme x:Key="{x:Type DockDockControl}" TargetType="DockDockControl">

<Setter Property="(ProportionalStackPanelSplitter.Proportion)" Value="{Binding Proportion}" x:DataType="core:IDock" />
<Setter Property="(ProportionalStackPanelSplitter.IsEmpty)" Value="{Binding IsEmpty}" x:DataType="core:IDock" />

<Setter Property="Template">
<ControlTemplate>
<DockableControl TrackingMode="Visible">
Expand Down
6 changes: 1 addition & 5 deletions src/Dock.Avalonia/Controls/DocumentDockControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,9 @@

<ControlTheme x:Key="{x:Type DocumentDockControl}" TargetType="DocumentDockControl">

<Setter Property="(ProportionalStackPanelSplitter.Proportion)" Value="{Binding Proportion}" x:DataType="core:IDock" />
<Setter Property="(ProportionalStackPanelSplitter.IsEmpty)" Value="{Binding IsEmpty}" x:DataType="core:IDock" />

<Setter Property="Template">
<ControlTemplate>
<DockableControl TrackingMode="Visible"
ProportionalStackPanelSplitter.Proportion="{Binding Proportion}">
<DockableControl TrackingMode="Visible">
<DocumentControl IsActive="{Binding IsActive}" />
</DockableControl>
</ControlTemplate>
Expand Down
4 changes: 3 additions & 1 deletion src/Dock.Avalonia/Controls/HostWindow.axaml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<ResourceDictionary xmlns="https://github.com/avaloniaui"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:core="using:Dock.Model.Core">
xmlns:core="using:Dock.Model.Core"
xmlns:controls="clr-namespace:Dock.Model.Controls;assembly=Dock.Model">
<Design.PreviewWith>
<HostWindow IsToolWindow="False" Width="300" Height="400" />
</Design.PreviewWith>
Expand All @@ -14,6 +15,7 @@
<Setter Property="WindowState" Value="Normal" />
<Setter Property="UseLayoutRounding" Value="True" />
<Setter Property="Title" Value="{Binding ActiveDockable.Title}" />
<Setter Property="Topmost" Value="{Binding Window.Topmost}" x:DataType="controls:IRootDock" />
<Setter Property="SystemDecorations" Value="Full" />
<Setter Property="ExtendClientAreaToDecorationsHint" Value="True" />
<Setter Property="ExtendClientAreaChromeHints" Value="PreferSystemChrome" />
Expand Down
18 changes: 11 additions & 7 deletions src/Dock.Avalonia/Controls/HostWindow.axaml.cs
Original file line number Diff line number Diff line change
@@ -1,11 +1,13 @@
using System;
using System.Linq;
using System.Runtime.InteropServices;
using Avalonia;
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.Styling;
using Avalonia.VisualTree;
using Dock.Avalonia.Internal;
using Dock.Model;
using Dock.Model.Core;
Expand Down Expand Up @@ -276,7 +278,15 @@ public void Present(bool isDialog)
Window.Factory?.OnWindowOpened(Window);
}

Show();
var ownerDockControl = Window?.Layout?.Factory?.DockControls.FirstOrDefault();
if (ownerDockControl is Control control && control.GetVisualRoot() is Window parentWindow)
{
Show(parentWindow);
}
else
{
Show();
}
}
}
}
Expand Down Expand Up @@ -334,12 +344,6 @@ public void GetSize(out double width, out double height)
height = Height;
}

/// <inheritdoc/>
public void SetTopmost(bool topmost)
{
Topmost = topmost;
}

/// <inheritdoc/>
public void SetTitle(string title)
{
Expand Down
18 changes: 11 additions & 7 deletions src/Dock.Avalonia/Controls/ProportionalDockControl.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,21 @@

<ControlTheme x:Key="{x:Type ProportionalDockControl}" TargetType="ProportionalDockControl">

<Setter Property="(ProportionalStackPanelSplitter.Proportion)" Value="{Binding Proportion}" x:DataType="core:IDock" />
<Setter Property="(ProportionalStackPanelSplitter.IsEmpty)" Value="{Binding IsEmpty}" x:DataType="core:IDock" />

<Setter Property="Template">
<ControlTemplate>
<DockableControl TrackingMode="Visible"
ProportionalStackPanelSplitter.Proportion="{Binding Proportion}">
<DockableControl TrackingMode="Visible">
<ItemsControl ItemsSource="{Binding VisibleDockables}">
<ItemsControl.Styles>
<Style Selector="ItemsControl > ContentPresenter > :is(core|IDock)" x:DataType="core:IDock">
<Setter Property="(ProportionalStackPanelSplitter.Proportion)" Value="{Binding Proportion}" />
<Style Selector="ItemsControl > ContentPresenter">
<Setter x:DataType="core:IDock" Property="(ProportionalStackPanel.Proportion)" Value="{Binding Proportion}" />
<Setter Property="(ProportionalStackPanel.IsCollapsed)">
<Setter.Value>
<MultiBinding Converter="{x:Static BoolConverters.And}" x:DataType="core:IDock">
<CompiledBinding Path="IsCollapsable" />
<CompiledBinding Path="IsEmpty" />
</MultiBinding>
</Setter.Value>
</Setter>
</Style>
</ItemsControl.Styles>
<ItemsControl.ItemsPanel>
Expand Down
Loading

0 comments on commit aeed334

Please sign in to comment.