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 FuncValueConverter with parameter support #15323

Conversation

wieslawsoltes
Copy link
Collaborator

@wieslawsoltes wieslawsoltes commented Apr 11, 2024

What does the pull request do?

Adds support for converter parameter into FuncValueConverter<TIn, TParam, TOut> and uses it to implement ObjectConverters.Equal and ObjectConverters.NotEqual converters

What is the current behavior?

No support for converter parameter in FuncValueConverter

What is the updated/expected behavior with this PR?

FuncValueConverter can be declared with parameter support in Func

How was the solution implemented (if it's not obvious)?

Created new version of generic FuncValueConverter<TIn, TParam, TOut>

Checklist

Breaking changes

Obsoletions / Deprecations

Fixed issues

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047178-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@@ -42,4 +42,44 @@ public FuncValueConverter(Func<TIn?, TOut> convert)
throw new NotImplementedException();
}
}

/// <summary>
/// A general purpose <see cref="IValueConverter"/> that uses a <see cref="Func{TIn, TParam, TResult}"/>
Copy link
Contributor

Choose a reason for hiding this comment

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

TResult should be TOut both here and above.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Fixed 10774a0

Copy link
Contributor

Choose a reason for hiding this comment

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

Line 8 should be changed too.

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

Oh missed that one e53f27b

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047182-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@avaloniaui-bot
Copy link

You can test this PR using the following package version. 11.2.999-cibuild0047184-alpha. (feed url: https://nuget-feed-all.avaloniaui.net/v3/index.json) [PRBUILDID]

@maxkatz6 maxkatz6 merged commit dd27d61 into AvaloniaUI:master Apr 11, 2024
10 checks passed
@maxkatz6 maxkatz6 added the backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch label Apr 11, 2024
@wieslawsoltes wieslawsoltes deleted the FuncValueConverterWithParameterSupport branch April 12, 2024 05:26
maxkatz6 pushed a commit that referenced this pull request Apr 20, 2024
* Add FuncValueConverter with parameter support

* Fix summary comment

* Fix summary comment

* Add Equal and NotEqual converters to a ObjectConverters class

* Fix condition for Equal

* Added ObjectConverters unit tests
@maxkatz6 maxkatz6 added backported-11.1.x and removed backport-candidate-11.1.x Consider this PR for backporting to 11.1 branch labels Apr 20, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants