Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update AbsoluteLayout Flags Extensions #216

Merged
merged 8 commits into from
May 24, 2023
Merged

Conversation

brminnick
Copy link
Collaborator

@brminnick brminnick commented Apr 22, 2023

Description of Change

This Proposal adds two new APIs to AbsoluteLayoutExtensions and updates the functionality of the existing .LayoutFlags() API to add existing AbsoluteLayoutFlags instead of overwriting existing AbsoluteLayoutFlags.

1. New APIs

public static TBindable ClearLayoutFlags<TBindable>(this TBindable bindable) where TBindable : BindableObject;

public static TBindable LayoutFlags<TBindable>(this TBindable bindable, params AbsoluteLayoutFlags[] flags) where TBindable : BindableObject;

2. Updating LayoutFlags Functionality

Current Functionality

The current functionality of LayoutFlags overwrites any existing AbsoluteLayoutFlags that are already defined by the BindableObject.

For example, the resulting AbosluteLayoutFlag property of the Label in the following sample will be only AbsoluteLayoutFlags.PositionProportional, because the current functionality overwrites any existing AbsoluteLayoutFlag.

new Label() // The label's final `AbsoluteLayoutFlags` value is `AbsoluteLayoutFlags.PositionProportional`
  .LayoutFlags(AbsoluteLayoutFlags.SizeProportional)
  .LayoutFlags(AbsoluteLayoutFlags.PositionProportional)  // Overwrites existing `AbsoluteLayoutFlags`

Updated Functionality

The updated functionality of LayoutFlags will append the incoming AbsoluteLayoutFlags to every existing AbsoluteLayoutFlags.

For example, the resulting AbosluteLayoutFlag property of the Label in the following sample will be AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.PositionProportional, because the incoming value combined with any existing AbsoluteLayoutFlag values using a bitwise OR operator.

new Label() // The label's final `AbsoluteLayoutFlags` value is `AbsoluteLayoutFlags.PositionProportional | AbsoluteLayoutFlags.SizeProportional `
  .LayoutFlags(AbsoluteLayoutFlags.SizeProportional)
  .LayoutFlags(AbsoluteLayoutFlags.PositionProportional)  // Combined with existing `AbsoluteLayoutFlags`

Linked Issues

PR Checklist

@brminnick brminnick added do not merge Do not merge this PR pending documentation This feature requires documentation needs discussion The team will aim to discuss this at the next monthly standup labels Apr 22, 2023
@brminnick brminnick removed the needs discussion The team will aim to discuss this at the next monthly standup label May 9, 2023
@brminnick brminnick marked this pull request as ready for review May 18, 2023 20:02
@brminnick brminnick requested a review from bijington May 18, 2023 20:02
@brminnick brminnick removed do not merge Do not merge this PR pending documentation This feature requires documentation labels May 18, 2023
Copy link
Contributor

@bijington bijington left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

@brminnick brminnick merged commit 6348b04 into main May 24, 2023
@brminnick brminnick deleted the Extend-`.LayoutFlags()` branch May 24, 2023 22:42
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[Proposal] Add AbsoluteLayout Flags Extension Methods
2 participants