Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 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
4 changes: 2 additions & 2 deletions src/Controls/src/Core/ContentPresenter.cs
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ internal virtual void Clear()
Content = null;
}

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
bool isFixedHorizontally = (Constraint & LayoutConstraint.HorizontallyFixed) != 0;
bool isFixedVertically = (Constraint & LayoutConstraint.VerticallyFixed) != 0;
Expand All @@ -99,7 +99,7 @@ protected override void ComputeConstraintForView(View view)
result |= LayoutConstraint.HorizontallyFixed;
}

view.ComputedConstraint = result;
return result;
}

internal override void SetChildInheritedBindingContext(Element child, object context)
Expand Down
4 changes: 2 additions & 2 deletions src/Controls/src/Core/Layout/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -357,7 +357,7 @@ protected override void OnBindingContextChanged()
UpdateRowColumnBindingContexts();
}

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
var result = LayoutConstraint.None;

Expand All @@ -371,7 +371,7 @@ protected override void ComputeConstraintForView(View view)
result |= LayoutConstraint.HorizontallyFixed;
}

view.ComputedConstraint = result;
return result;
}

bool ViewHasFixedHeightDefinition(BindableObject view)
Expand Down
6 changes: 3 additions & 3 deletions src/Controls/src/Core/Layout/HorizontalStackLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public class HorizontalStackLayout : StackBase
{
protected override ILayoutManager CreateLayoutManager() => new HorizontalStackLayoutManager(this);

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
if ((Constraint & LayoutConstraint.VerticallyFixed) != 0 && view.VerticalOptions.Alignment == LayoutAlignment.Fill)
{
view.ComputedConstraint = LayoutConstraint.VerticallyFixed;
return LayoutConstraint.VerticallyFixed;
}
else
{
view.ComputedConstraint = LayoutConstraint.None;
return LayoutConstraint.None;
}
}
}
Expand Down
10 changes: 5 additions & 5 deletions src/Controls/src/Core/Layout/StackLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -37,28 +37,28 @@ protected override ILayoutManager CreateLayoutManager()
return new StackLayoutManager(this);
}

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
if (Orientation == StackOrientation.Horizontal)
{
if ((Constraint & LayoutConstraint.VerticallyFixed) != 0 && view.VerticalOptions.Alignment == LayoutAlignment.Fill)
{
view.ComputedConstraint = LayoutConstraint.VerticallyFixed;
return LayoutConstraint.VerticallyFixed;
}
else
{
view.ComputedConstraint = LayoutConstraint.None;
return LayoutConstraint.None;
}
}
else
{
if ((Constraint & LayoutConstraint.HorizontallyFixed) != 0 && view.HorizontalOptions.Alignment == LayoutAlignment.Fill)
{
view.ComputedConstraint = LayoutConstraint.HorizontallyFixed;
return LayoutConstraint.HorizontallyFixed;
}
else
{
view.ComputedConstraint = LayoutConstraint.None;
return LayoutConstraint.None;
}
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/Controls/src/Core/Layout/VerticalStackLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,15 @@ public class VerticalStackLayout : StackBase
{
protected override ILayoutManager CreateLayoutManager() => new VerticalStackLayoutManager(this);

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
if ((Constraint & LayoutConstraint.HorizontallyFixed) != 0 && view.HorizontalOptions.Alignment == LayoutAlignment.Fill)
{
view.ComputedConstraint = LayoutConstraint.HorizontallyFixed;
return LayoutConstraint.HorizontallyFixed;
}
else
{
view.ComputedConstraint = LayoutConstraint.None;
return LayoutConstraint.None;
}
}
}
Expand Down
8 changes: 4 additions & 4 deletions src/Controls/src/Core/LegacyLayouts/AbsoluteLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -109,17 +109,17 @@ protected override SizeRequest OnMeasure(double widthConstraint, double heightCo
return new SizeRequest(bestFitSize, minimum);
}

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
AbsoluteLayoutFlags layoutFlags = GetLayoutFlags(view);

if ((layoutFlags & AbsoluteLayoutFlags.SizeProportional) == AbsoluteLayoutFlags.SizeProportional)
{
if (view.VerticalOptions.Alignment == LayoutAlignment.Fill &&
view.HorizontalOptions.Alignment == LayoutAlignment.Fill)
view.ComputedConstraint = Constraint;
return Constraint;

return;
return LayoutConstraint.None;
}

var result = LayoutConstraint.None;
Expand All @@ -146,7 +146,7 @@ protected override void ComputeConstraintForView(View view)
result |= LayoutConstraint.VerticallyFixed;
}

view.ComputedConstraint = result;
return result;
}

void ChildOnPropertyChanged(object sender, PropertyChangedEventArgs e)
Expand Down
6 changes: 3 additions & 3 deletions src/Controls/src/Core/LegacyLayouts/Grid.cs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ protected override void OnRemoved(View view)
view.PropertyChanged -= OnItemPropertyChanged;
}

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
LayoutOptions vOptions = view.VerticalOptions;
LayoutOptions hOptions = view.HorizontalOptions;
Expand Down Expand Up @@ -235,7 +235,7 @@ protected override void ComputeConstraintForView(View view)
result |= LayoutConstraint.HorizontallyFixed;
}

view.ComputedConstraint = result;
return result;
}

[EditorBrowsable(EditorBrowsableState.Never)]
Expand All @@ -259,7 +259,7 @@ void OnItemPropertyChanged(object sender, PropertyChangedEventArgs e)
var child = sender as View;
if (child != null)
{
ComputeConstraintForView(child);
child.ComputedConstraint = ComputeConstraintForView(child);
}

InvalidateLayout();
Expand Down
26 changes: 13 additions & 13 deletions src/Controls/src/Core/LegacyLayouts/StackLayout.cs
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@ internal override void OnChildMeasureInvalidated(VisualElement child, Invalidati
base.OnChildMeasureInvalidated(child, trigger);
}

protected override void ComputeConstraintForView(View view)
protected override LayoutConstraint ComputeConstraintForView(View view)
{
ComputeConstraintForView(view, false);
return ComputeConstraintForView(view, false);
}

internal override void InvalidateMeasureInternal(InvalidationTrigger trigger)
Expand Down Expand Up @@ -172,7 +172,7 @@ void CalculateNaiveLayout(LayoutInformation layout, StackOrientation orientation
if (expander != null)
{
// we have multiple expanders, make sure previous expanders are reset to not be fixed because they no logner are
ComputeConstraintForView(child, false);
child.ComputedConstraint = ComputeConstraintForView(child, false);
}
expander = child;
}
Expand All @@ -191,7 +191,7 @@ void CalculateNaiveLayout(LayoutInformation layout, StackOrientation orientation
}
minimumHeight -= spacing;
if (expander != null)
ComputeConstraintForView(expander, layout.Expanders == 1); // warning : slightly obtuse, but we either need to setup the expander or clear the last one
expander.ComputedConstraint = ComputeConstraintForView(expander, layout.Expanders == 1); // warning : slightly obtuse, but we either need to setup the expander or clear the last one
}
else
{
Expand All @@ -207,7 +207,7 @@ void CalculateNaiveLayout(LayoutInformation layout, StackOrientation orientation
layout.Expanders++;
if (expander != null)
{
ComputeConstraintForView(child, false);
child.ComputedConstraint = ComputeConstraintForView(child, false);
}
expander = child;
}
Expand All @@ -226,7 +226,7 @@ void CalculateNaiveLayout(LayoutInformation layout, StackOrientation orientation
}
minimumWidth -= spacing;
if (expander != null)
ComputeConstraintForView(expander, layout.Expanders == 1);
expander.ComputedConstraint = ComputeConstraintForView(expander, layout.Expanders == 1);
}

layout.Bounds = new Rect(x, y, boundsWidth, boundsHeight);
Expand Down Expand Up @@ -362,24 +362,24 @@ void CompressVerticalLayout(LayoutInformation layout, double widthConstraint, do
}
}

void ComputeConstraintForView(View view, bool isOnlyExpander)
LayoutConstraint ComputeConstraintForView(View view, bool isOnlyExpander)
{
if (Orientation == StackOrientation.Horizontal)
{
if ((Constraint & LayoutConstraint.VerticallyFixed) != 0 && view.VerticalOptions.Alignment == LayoutAlignment.Fill)
{
if (isOnlyExpander && view.HorizontalOptions.Alignment == LayoutAlignment.Fill && Constraint == LayoutConstraint.Fixed)
{
view.ComputedConstraint = LayoutConstraint.Fixed;
return LayoutConstraint.Fixed;
}
else
{
view.ComputedConstraint = LayoutConstraint.VerticallyFixed;
return LayoutConstraint.VerticallyFixed;
}
}
else
{
view.ComputedConstraint = LayoutConstraint.None;
return LayoutConstraint.None;
}
}
else
Expand All @@ -388,16 +388,16 @@ void ComputeConstraintForView(View view, bool isOnlyExpander)
{
if (isOnlyExpander && view.VerticalOptions.Alignment == LayoutAlignment.Fill && Constraint == LayoutConstraint.Fixed)
{
view.ComputedConstraint = LayoutConstraint.Fixed;
return LayoutConstraint.Fixed;
}
else
{
view.ComputedConstraint = LayoutConstraint.HorizontallyFixed;
return LayoutConstraint.HorizontallyFixed;
}
}
else
{
view.ComputedConstraint = LayoutConstraint.None;
return LayoutConstraint.None;
}
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/Controls/src/Core/ListView/ListView.cs
Original file line number Diff line number Diff line change
Expand Up @@ -446,8 +446,6 @@ protected override SizeRequest OnMeasure(double widthConstraint, double heightCo
protected override void SetupContent(Cell content, int index)
{
base.SetupContent(content, index);
if (content is ViewCell viewCell && viewCell.View != null && HasUnevenRows)
viewCell.View.ComputedConstraint = LayoutConstraint.None;

if (content != null)
{
Expand Down
24 changes: 12 additions & 12 deletions src/Controls/src/Core/PublicAPI/net-android/PublicAPI.Unshipped.txt
Original file line number Diff line number Diff line change
Expand Up @@ -270,12 +270,12 @@ override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConv
override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
override Microsoft.Maui.Controls.ColumnDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object?
~override Microsoft.Maui.Controls.Compatibility.AbsoluteLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.Compatibility.Grid.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.Compatibility.AbsoluteLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
~override Microsoft.Maui.Controls.Compatibility.Grid.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
~override Microsoft.Maui.Controls.Compatibility.Layout.OnChildAdded(Microsoft.Maui.Controls.Element child) -> void
~override Microsoft.Maui.Controls.Compatibility.Layout.OnChildRemoved(Microsoft.Maui.Controls.Element child, int oldLogicalIndex) -> void
~override Microsoft.Maui.Controls.Compatibility.StackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.ContentPresenter.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.Compatibility.StackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
~override Microsoft.Maui.Controls.ContentPresenter.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
override Microsoft.Maui.Controls.ContentPresenter.InvalidateLayout() -> void
override Microsoft.Maui.Controls.ContentPresenter.Measure(double widthConstraint, double heightConstraint, Microsoft.Maui.Controls.MeasureFlags flags = Microsoft.Maui.Controls.MeasureFlags.None) -> Microsoft.Maui.SizeRequest
override Microsoft.Maui.Controls.ContentPresenter.OnChildMeasureInvalidated() -> void
Expand All @@ -299,12 +299,12 @@ override Microsoft.Maui.Controls.FontSizeConverter.CanConvertFrom(System.Compone
override Microsoft.Maui.Controls.FontSizeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.FontSizeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
override Microsoft.Maui.Controls.FontSizeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object?
~override Microsoft.Maui.Controls.Grid.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.Grid.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
override Microsoft.Maui.Controls.GridLengthTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool
override Microsoft.Maui.Controls.GridLengthTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.GridLengthTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
override Microsoft.Maui.Controls.GridLengthTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object?
~override Microsoft.Maui.Controls.HorizontalStackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.HorizontalStackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
override Microsoft.Maui.Controls.ImageSourceConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool
override Microsoft.Maui.Controls.ImageSourceConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.ImageSourceConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
Expand Down Expand Up @@ -335,7 +335,7 @@ override Microsoft.Maui.Controls.RowDefinitionCollectionTypeConverter.CanConvert
override Microsoft.Maui.Controls.RowDefinitionCollectionTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.RowDefinitionCollectionTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
override Microsoft.Maui.Controls.RowDefinitionCollectionTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object?
~override Microsoft.Maui.Controls.ScrollView.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.ScrollView.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
override Microsoft.Maui.Controls.ScrollView.InvalidateLayout() -> void
override Microsoft.Maui.Controls.ScrollView.Measure(double widthConstraint, double heightConstraint, Microsoft.Maui.Controls.MeasureFlags flags = Microsoft.Maui.Controls.MeasureFlags.None) -> Microsoft.Maui.SizeRequest
override Microsoft.Maui.Controls.ScrollView.OnChildMeasureInvalidated() -> void
Expand Down Expand Up @@ -366,9 +366,9 @@ override Microsoft.Maui.Controls.Shapes.TransformTypeConverter.CanConvertFrom(Sy
override Microsoft.Maui.Controls.Shapes.TransformTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.Shapes.TransformTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
override Microsoft.Maui.Controls.Shapes.TransformTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object?
~override Microsoft.Maui.Controls.StackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.TemplatedPage.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.TemplatedView.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.StackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
~override Microsoft.Maui.Controls.TemplatedPage.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
~override Microsoft.Maui.Controls.TemplatedView.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
override Microsoft.Maui.Controls.TemplatedView.InvalidateLayout() -> void
override Microsoft.Maui.Controls.TemplatedView.OnChildMeasureInvalidated() -> void
override Microsoft.Maui.Controls.TemplatedView.OnSizeAllocated(double width, double height) -> void
Expand All @@ -387,7 +387,7 @@ override Microsoft.Maui.Controls.UriTypeConverter.CanConvertFrom(System.Componen
override Microsoft.Maui.Controls.UriTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.UriTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
override Microsoft.Maui.Controls.UriTypeConverter.ConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object? value, System.Type! destinationType) -> object?
~override Microsoft.Maui.Controls.VerticalStackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~override Microsoft.Maui.Controls.VerticalStackLayout.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
override Microsoft.Maui.Controls.WebViewSourceTypeConverter.CanConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Type! sourceType) -> bool
override Microsoft.Maui.Controls.WebViewSourceTypeConverter.CanConvertTo(System.ComponentModel.ITypeDescriptorContext? context, System.Type? destinationType) -> bool
override Microsoft.Maui.Controls.WebViewSourceTypeConverter.ConvertFrom(System.ComponentModel.ITypeDescriptorContext? context, System.Globalization.CultureInfo? culture, object! value) -> object?
Expand Down Expand Up @@ -510,4 +510,4 @@ virtual Microsoft.Maui.Controls.Handlers.TabbedPageManager.UpdateStyleForTabItem
virtual Microsoft.Maui.Controls.Handlers.TabbedPageManager.UpdateTabIcons() -> void
~virtual Microsoft.Maui.Controls.Internals.EvaluateJavaScriptDelegate.Invoke(string script) -> System.Threading.Tasks.Task<string>
~virtual Microsoft.Maui.Controls.PropertyChangingEventHandler.Invoke(object sender, Microsoft.Maui.Controls.PropertyChangingEventArgs e) -> void
~virtual Microsoft.Maui.Controls.VisualElement.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> void
~virtual Microsoft.Maui.Controls.VisualElement.ComputeConstraintForView(Microsoft.Maui.Controls.View view) -> Microsoft.Maui.Controls.LayoutConstraint
Loading
Loading