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

New extension for toggling element visibility based on the GlobalProvider state #106

Merged
merged 5 commits into from
Jun 11, 2021

Conversation

shweaver-MSFT
Copy link
Member

@shweaver-MSFT shweaver-MSFT commented May 27, 2021

Contributes to #97

PR Type

What kind of change does this PR introduce?

  • Feature

What is the new behavior?

You can now toggle visibility for elements based on the specified provider state:

<TextBlock wgt:ElementExtensions.IsVisibleWhen="SignedIn" Text="Only visible when signed in" />
<TextBlock wgt:ElementExtensions.IsVisibleWhen="SignedOut" Text="Only visible when signed out" />
<TextBlock wgt:ElementExtensions.IsVisibleWhen="Loading" Text="You get the picture" />

PR Checklist

Please check if your PR fulfills the following requirements:

  • Tested code with current supported SDKs
  • Sample in sample app has been added / updated (for bug fixes / features)
  • 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

Other information

I'm not totally in love with "ElementExtensions" as the name, but don't have any better ideas and it is better than "FrameworkElementExtensions" which I think is just too long for simple usage in XAML. "ProviderExtensions" and "GraphExtensions" seem interesting, but we aren't really extending the providers or Graph client. I'm open to input.

@ghost
Copy link

ghost commented May 27, 2021

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

@ghost ghost assigned azchohfi May 27, 2021
@shweaver-MSFT
Copy link
Member Author

shweaver-MSFT commented Jun 2, 2021

Thanks for the feedback @michael-hawker :)

Thinking about naming as well since it is a bit verbose... What do you think about:

<TextBlock wgt:ProviderExtensions.IsVisibleWhen="SignedIn" Text="Only visible when signed in" />
<TextBlock wgt:ProviderExtensions.IsVisibleWhen="SignedOut" Text="Only visible when signed out" />
<TextBlock wgt:ProviderExtensions.IsVisibleWhen="Loading" Text="You get the picture" />

CommunityToolkit.Graph.Uwp.ProviderExtensions is a bit funny naming, since it wouldn't be the same as the existing CommunityToolkit.Graph.ProviderExtensions. But I don't know if that is necessarily a bad thing... They are both static and will likely never be used in the same context (XAML vs in code).

Thoughts? What do you think @nmetulev?

I'm very open to other naming ideas 😅

@shweaver-MSFT shweaver-MSFT changed the title Added ElementExtensions New extension for toggling element visibility based on the GlobalProvider state Jun 2, 2021
@shweaver-MSFT
Copy link
Member Author

shweaver-MSFT commented Jun 7, 2021

@michael-hawker, also curious on your thoughts for restructuring the naming scheme ^

@shweaver-MSFT shweaver-MSFT merged commit fda4975 into dev/7.1.0 Jun 11, 2021
@shweaver-MSFT shweaver-MSFT deleted the shweaver/element-ex branch June 11, 2021 17:45
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.

3 participants