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

IProvideValueTarget.TargetObject should return the target object and not itself #4601

Closed
thexamlguy opened this issue Sep 2, 2020 · 3 comments · Fixed by kekekeks/XamlX#125

Comments

@thexamlguy
Copy link

I am attempting to port over this WPF MethodBindingExtension over to Avalonia UI. The only thing that is currently blocking me is that the IProvideValueTarget TargetObject is returning itself (as in the MarkupExtension class) rather than the actual object
the MarkupExtension is being used within, i.e. Button. I've compared this behaviour in WPF and I can see that the IProvideValueTarget is returning the correct TargetObject.

Avalonia UI
image

WPF
image

I can only assume that this is a bug, unless of course Avalonia is correct?

@kekekeks
Copy link
Member

kekekeks commented Sep 2, 2020

Seems like a bug, could you share your project?

@kekekeks
Copy link
Member

kekekeks commented Sep 2, 2020

Also, keep in mind that services should be resolved and consumed before leaving ProvideValue. The IProvideValueTarget instance is reused, so it will contain irrelevant values otherwise.

@thexamlguy
Copy link
Author

I've chucked together a quick sample Avalonia UI app containing the relevant codes, hope it helps 👍
AvaloniaApplication1.zip

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants