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

Add Support for IValueConverter in Typed Bindings Extensions #183

Merged

Conversation

brminnick
Copy link
Collaborator

@brminnick brminnick commented Feb 13, 2023

Description of Change

This PR adds support for IValueConverter with Typed Bindings extensions

Linked Issues

PR Checklist

Additional information

Allows the use of IValueConverter with the new Typed Bindings extensions, such as CommunityToolkit.Maui.Converters.ColorToHexRgbStringConverter in the .NET MAUI Community Toolkit:

new Label().Bind<Label, ViewModel, Color, string>(Label.TextProperty,
				static (ViewModel viewModel) => viewModel.TextColor,
				converter: new ColorToHexRgbStringConverter());

@brminnick brminnick added do not merge Do not merge this PR pending documentation This feature requires documentation labels Feb 13, 2023
@brminnick
Copy link
Collaborator Author

@bijington Are you able to update the docs for this PR?

I know you've already got a list of the binding examples that couldn't be updated when we implemented #155.

@brminnick brminnick changed the title Support i value converter in .bind() with typed binings Add Support for IValueConverter in Typed Bindings Extensions Feb 13, 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.

Great work @brminnick. There is just the minor comment around the unit test code but we probably don't need to change that

@brminnick
Copy link
Collaborator Author

Thanks Shaun! I agree that we could reuse the code in the Unit Test, but to be honest I've found it a bit of an anti-pattern to try and share code between Unit Tests. I copy/pasted Xamarin.CommunityToolkit.Markup.UnitTests and I wish I hadn't because it has so many base classes and helper methods that it became tough to maintain and tough to write new Unit Tests.

Thanks for helping with the Docs! I'll wait to merge this PR until we have a Docs PR queued up.

@bijington
Copy link
Contributor

@bijington Are you able to update the docs for this PR?

I know you've already got a list of the binding examples that couldn't be updated when we implemented #155.

Here you go: MicrosoftDocs/CommunityToolkit#226

@brminnick brminnick removed do not merge Do not merge this PR pending documentation This feature requires documentation labels Feb 14, 2023
@brminnick brminnick added this pull request to the merge queue Feb 14, 2023
@brminnick brminnick removed this pull request from the merge queue due to a manual request Feb 14, 2023
@brminnick brminnick merged commit 13e9a6f into main Feb 14, 2023
@brminnick brminnick deleted the Support-`IValueConverter`-in-`.Bind()`-with-TypedBinings branch February 14, 2023 19:41
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] Further enhance Bind typed binding support to provide IValueConverter support
2 participants