diff --git a/src/Avalonia.Controls/DefinitionBase.cs b/src/Avalonia.Controls/DefinitionBase.cs index d04578b371..dd97e7ea1e 100644 --- a/src/Avalonia.Controls/DefinitionBase.cs +++ b/src/Avalonia.Controls/DefinitionBase.cs @@ -110,11 +110,11 @@ namespace Avalonia.Controls /// internal void OnUserSizePropertyChanged(AvaloniaPropertyChangedEventArgs e) { - if (InParentLogicalTree) + if (Parent != null) { if (_sharedState != null) { - _sharedState.Invalidate(); + _sharedState?.Invalidate(); } else { @@ -129,21 +129,7 @@ namespace Avalonia.Controls } } } - - /// - /// This method needs to be internal to be accessable from derived classes. - /// - internal static void OnUserMinSizePropertyChanged(AvaloniaObject d, AvaloniaPropertyChangedEventArgs e) - { - DefinitionBase definition = (DefinitionBase)d; - - if (definition.InParentLogicalTree) - { - Grid parentGrid = (Grid)definition.Parent; - parentGrid.InvalidateMeasure(); - } - } - + /// /// This method reflects Grid.SharedScopeProperty state by setting / clearing /// dynamic property PrivateSharedSizeScopeProperty. Value of PrivateSharedSizeScopeProperty @@ -317,14 +303,6 @@ namespace Avalonia.Controls /// internal abstract double UserMaxSizeValueCache { get; } - /// - /// Protected. Returns true if this DefinitionBase instance is in parent's logical tree. - /// - internal bool InParentLogicalTree - { - get { return (_parentIndex != -1); } - } - internal Grid Parent { get; set; } /// @@ -349,7 +327,7 @@ namespace Avalonia.Controls { DefinitionBase definition = (DefinitionBase)d; - if (definition.InParentLogicalTree) + if (definition.Parent != null) { string sharedSizeGroupId = (string)e.NewValue; @@ -421,7 +399,7 @@ namespace Avalonia.Controls { DefinitionBase definition = (DefinitionBase)d; - if (definition.InParentLogicalTree) + if (definition.Parent != null) { SharedSizeScope privateSharedSizeScope = (SharedSizeScope)e.NewValue; @@ -787,4 +765,4 @@ namespace Avalonia.Controls PrivateSharedSizeScopeProperty.Changed.AddClassHandler(OnPrivateSharedSizeScopePropertyChanged); } } -} \ No newline at end of file +} diff --git a/src/Avalonia.Controls/Grid.cs b/src/Avalonia.Controls/Grid.cs index 5a44b93941..519732e36a 100644 --- a/src/Avalonia.Controls/Grid.cs +++ b/src/Avalonia.Controls/Grid.cs @@ -1726,7 +1726,7 @@ namespace Avalonia.Controls /// /// Array of definitions to process. /// Final size to lay out to. - /// True if sizing row definitions, false for columns + /// True if sizing row definitions, false for columns private void SetFinalSize( IReadOnlyList definitions, double finalSize, @@ -2303,29 +2303,7 @@ namespace Avalonia.Controls } } } - - /// - /// Returns true if ColumnDefinitions collection is not empty - /// - public bool ShouldSerializeColumnDefinitions() - { - ExtendedData extData = ExtData; - return (extData != null - && extData.ColumnDefinitions != null - && extData.ColumnDefinitions.Count > 0); - } - - /// - /// Returns true if RowDefinitions collection is not empty - /// - public bool ShouldSerializeRowDefinitions() - { - ExtendedData extData = ExtData; - return (extData != null - && extData.RowDefinitions != null - && extData.RowDefinitions.Count > 0); - } - + /// /// Synchronized ShowGridLines property with the state of the grid's visual collection /// by adding / removing GridLinesRenderer visual. @@ -3392,4 +3370,4 @@ namespace Avalonia.Controls private static readonly Pen _evenDashPen; // second pen to draw dash } } -} \ No newline at end of file +}