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

feat: Enable Grid to dynamically switch layouts #4474

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

nandin-borjigin
Copy link

@nandin-borjigin nandin-borjigin commented Feb 2, 2022

Fixes #4470 CommunityToolkit/Labs-Windows#232

Added attached properties to Grid element to enable dynamic layout switching.

PR Type

What kind of change does this PR introduce?

Feature

What is the current behavior?

We cannot switch Grid layouts dynamically once it's defined.

What is the new behavior?

One can define as many layouts (dictionary of string to GridLayoutDefinition, a newly added data structure to describe a grid layout) as desired in a Grid element and switch among them using the newly added GridExtensions.ActiveLayout (string, it's the dictionary key of the corresponding layout definition) attached property associated with the Grid element.

1

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • New component
    • Pull Request has been submitted to the documentation repository instructions. Link: PR 602
    • Added description of major feature to project description for NuGet package (4000 total character limit, so don't push entire description over that)
    • If control, added to Visual Studio Design project
  • Sample in sample app has been added / updated (for bug fixes / features)
  • New major technical changes in the toolkit have or will be added to the Wiki e.g. build changes, source generators, testing infrastructure, sample creation changes, etc...
  • Tests for the changes have been added (for bug fixes / features) (if applicable)
  • Header has been added to all new source files (run build/UpdateHeaders.bat)
  • Contains NO breaking changes

@ghost
Copy link

ghost commented Feb 2, 2022

Thanks nandin-borjigin for opening a Pull Request! The reviewers will test the PR and highlight if there is any conflict or changes required. If the PR is approved we will proceed to merge the pull request 🙌

Co-authored-by: XAML-Knight <86266896+XAML-Knight@users.noreply.github.com>
@ghost
Copy link

ghost commented Feb 3, 2022

This PR has been marked as "needs attention 👋" and awaiting a response from the team.

Copy link
Contributor

@XAML-Knight XAML-Knight left a comment

Choose a reason for hiding this comment

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

Nice implementation - like the simplicity in defining a grid layout

@michael-hawker michael-hawker marked this pull request as draft February 3, 2022 21:33
@michael-hawker michael-hawker added extensions ⚡ feature 💡 labs 🧪 Marks an issue/PR involved with Toolkit Labs and removed needs attention 👋 labels Feb 3, 2022
Copy link
Member

@Arlodotexe Arlodotexe left a comment

Choose a reason for hiding this comment

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

Looks pretty good. I might add some UI tests and potential test cases, though.

/// This usage is not really invalid (it does not throw),
/// but this API is not expected to be used like this.
/// </example>
public string AreaDefinition
Copy link
Member

Choose a reason for hiding this comment

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

Do we maybe want to rename this AreaDefinitions (plural) to align with the others, RowDefinitions and ColumnDefinitions?

Copy link
Author

Choose a reason for hiding this comment

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

There is only one area definition per layout definition, whereas row definitions and column definitions are multiple.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
extensions ⚡ feature 💡 labs 🧪 Marks an issue/PR involved with Toolkit Labs
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants