question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

[Spec] drop AndExpand layout option

See original GitHub issue

Description

The AndExpand suffix on some LayoutOptions is confusing at best, harmful and expensive at its worst.

It only make sense to have a single element (per axis) with AndExpand flag set, and only for a handful of layouts (StackLayout and Grid, mainly).

If a layout contains multiple expandable children per direction:

  • it should warn the user
  • all but the last one (in the direction) should be ignored

We could also optimize the layouts for these restrictions (reducing the measure for expand items, e.g.).

API

struct LayoutOptions,

Remove or [Obsolete]

class LayoutOptionsConverter

Remove or [Obsolete]

enum LayoutExpandFlag

Remove or [Obsolete]

class View

Properties and BindableProperties

Replace Vertical|HorizontalOptions[Property] by Vertical|HorizontalAlignment[Property]

API Description
public LayoutAlignment VerticalAlignment Gets or sets the verticalAlignemnt.
public LayoutAlignment HorizontalAlignment Gets or sets the verticalAlignemnt.
public static readonly BindableProperty VerticalAlignmentProperty bp for VerticalAlignemnt
public static readonly BindableProperty HorizontalAlignmentProperty bp for HorizontalAlignemnt

Add bool Vertical|HorizontalExpand[Property]. An attached BindableProperty would be more suited, as technically the Expand is only valid within some layouts, but the syntax would be harder for the user.

Scenarios

C# Example

var button = new Button();
button.ExpandVertically = true;
button.VerticalAlignment = LayoutAlignment.Center;

XAML Example

<Button x:Name="thing" ExpandVertically="true" VerticalAlignemnt="Center" />

CSS Example

Expansion is not supported in CSS

Backward Compatibility

Minimum API levels: N/A

Breaking changes: this require some modification in user XAML and code. The rule about a single expandable might produce different results than what we actually have.

Difficulty : medium

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:22
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

4reactions
mattleibowcommented, Sep 14, 2020

Is it not better to use a weight system?

So if I have a stack with 3 items, and each has a VerticalOptions of Fill, then each gets the current height.

If I set them all to be Weight=1, then it overrides the space because it will do a RemainingHeight/3 and then set that to be the height. Even if the first item say requires 90% of the space?

0reactions
jsuarezruizcommented, Nov 9, 2021

Take a look to the discussion here: https://github.com/dotnet/maui/discussions/3324

Read more comments on GitHub >

github_iconTop Results From Across the Web

Layout options with AndExpand are deprecated from .Net ...
When I'm using StackLayout with options like FillAndExpand, CenterAndExpand it shows this message The StackLayout expansion options are ...
Read more >
Specification Software | SpecLink Tutorial | How It Works
SpecLink is intuitive specification-writing software that helps you make more informed decisions, faster, through every phase of the design process.
Read more >
Set Up and Configure AMD Eyefinity
To access the AMD Eyefinity Multi-Display options via Try Advanced Setup, ... and uncheck Lock the Taskbar, then drag and drop it to...
Read more >
Webcast Elite | Registration Page Design
Use the Design drop-down to update the stylings and content on your registration and lobby pages.
Read more >
Overview of BI Publisher Layouts
The BI Publisher Layout template enables end users to: View Dynamic HTML output and perform lightweight interaction with their report data from within...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found