Browse Source

Update Measure and Layout if a child of RelativePanel updates it's

position.
pull/10361/head
Tim 3 years ago
parent
commit
9fc9a32f22
  1. 39
      src/Avalonia.Controls/RelativePanel.AttachedProperties.cs

39
src/Avalonia.Controls/RelativePanel.AttachedProperties.cs

@ -1,37 +1,30 @@
using Avalonia.Layout;
using Avalonia.Threading;
namespace Avalonia.Controls
{
public partial class RelativePanel
{
private static void OnAlignPropertiesChanged(AvaloniaObject d, AvaloniaPropertyChangedEventArgs e)
{
if (d is Layoutable layoutable && layoutable.Parent is Layoutable layoutableParent)
{
layoutableParent.InvalidateArrange();
}
}
static RelativePanel()
{
ClipToBoundsProperty.OverrideDefaultValue<RelativePanel>(true);
AboveProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignBottomWithPanelProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignBottomWithProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignHorizontalCenterWithPanelProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignHorizontalCenterWithProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignLeftWithPanelProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignLeftWithProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignRightWithPanelProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignRightWithProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignTopWithPanelProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignTopWithProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignVerticalCenterWithPanelProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AlignVerticalCenterWithProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
BelowProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
LeftOfProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
RightOfProperty.Changed.AddClassHandler<Layoutable>(OnAlignPropertiesChanged);
AffectsParentArrange<RelativePanel>(
AlignLeftWithPanelProperty, AlignLeftWithProperty, LeftOfProperty,
AlignRightWithPanelProperty, AlignRightWithProperty, RightOfProperty,
AlignTopWithPanelProperty, AlignTopWithProperty, AboveProperty,
AlignBottomWithPanelProperty, AlignBottomWithProperty, BelowProperty,
AlignHorizontalCenterWithPanelProperty, AlignHorizontalCenterWithProperty,
AlignVerticalCenterWithPanelProperty, AlignVerticalCenterWithProperty);
AffectsParentMeasure<RelativePanel>(
AlignLeftWithPanelProperty, AlignLeftWithProperty, LeftOfProperty,
AlignRightWithPanelProperty, AlignRightWithProperty, RightOfProperty,
AlignTopWithPanelProperty, AlignTopWithProperty, AboveProperty,
AlignBottomWithPanelProperty, AlignBottomWithProperty, BelowProperty,
AlignHorizontalCenterWithPanelProperty, AlignHorizontalCenterWithProperty,
AlignVerticalCenterWithPanelProperty, AlignVerticalCenterWithProperty);
}
/// <summary>

Loading…
Cancel
Save