Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,10 @@
Classes="ProportionalStackPanel">
<ItemsControl.Styles>
<Style Selector="ItemsControl.ProportionalStackPanel > ContentPresenter">
<Setter Property="(ProportionalStackPanel.Proportion)"
Value="{Binding Proportion, Mode=TwoWay}" />
<Setter Property="(ProportionalStackPanel.CollapsedProportion)"
Value="{Binding CollapsedProportion}" />
Value="{Binding CollapsedProportion, Mode=TwoWay}" />
<Setter Property="(ProportionalStackPanel.IsCollapsed)">
<Setter.Value>
<MultiBinding Converter="{x:Static BoolConverters.And}">
Expand Down
33 changes: 0 additions & 33 deletions src/Dock.Avalonia/Controls/ProportionalDockControl.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,6 @@
using Avalonia.Controls;
using Avalonia.Controls.Metadata;
using Avalonia.Controls.Primitives;
using Avalonia.Data;
using Dock.Controls.ProportionalStackPanel;
using Dock.Model.Core;

namespace Dock.Avalonia.Controls;

Expand All @@ -16,34 +13,4 @@ namespace Dock.Avalonia.Controls;
[TemplatePart("PART_ItemsControl", typeof(ItemsControl), IsRequired = true)]
public class ProportionalDockControl : TemplatedControl
{
private ItemsControl? _itemsControl;

/// <inheritdoc />
protected override void OnApplyTemplate(TemplateAppliedEventArgs e)
{
// Unsubscribe from the previous ItemsControl if it exists
if (_itemsControl != null)
{
_itemsControl.ContainerPrepared -= ItemsControlOnContainerPrepared;
_itemsControl = null;
}

base.OnApplyTemplate(e);

var itemsControl = e.NameScope.Find<ItemsControl>("PART_ItemsControl");

if (itemsControl != null)
{
_itemsControl = itemsControl;
_itemsControl.ContainerPrepared += ItemsControlOnContainerPrepared;
}
}

private void ItemsControlOnContainerPrepared(object? sender, ContainerPreparedEventArgs e)
{
if (e.Container.DataContext is IDockable)
{
e.Container[!ProportionalStackPanel.ProportionProperty] = new Binding(nameof(IDockable.Proportion));
}
}
}
Loading