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

[Bug]: ViewModelViewHost does not set DataContext in WPF #3716

Closed
jhimes144 opened this issue Jan 21, 2024 · 2 comments
Closed

[Bug]: ViewModelViewHost does not set DataContext in WPF #3716

jhimes144 opened this issue Jan 21, 2024 · 2 comments
Labels

Comments

@jhimes144
Copy link

Describe the bug 🐞

In Avalonia, their ViewModelViewHost correctly sets the datacontext for a view to the wired view model. In WPF, the default ViewModelViewHost implementation does not do this, you are forced to manually set the DataContext after view activation. I suspect this is because the generic design of the ViewModelHost to allow it to work for various UI frameworks, because there is no code within to do this.

Step to reproduce

  1. Create a WPF app with a ViewModelViewHost with ViewModel set to a viewmodel with a view declared.
  2. Observe that bindings do not work.

Reproduction repository

https://github.com/reactiveui/ReactiveUI

Expected behavior

Using the ViewModelViewHost, should both render my view and bindings should work.

Screenshots 🖼️

No response

IDE

Rider Windows

Operating system

Windows

Version

11

Device

PC

ReactiveUI Version

19.5.39

Additional information ℹ️

No response

@jhimes144 jhimes144 added the bug label Jan 21, 2024
@glennawatson
Copy link
Contributor

We don't set the DataContext by design. Rxui does not require it if you do rxui binding. The user can set the datacontext if they want with the rxui binding.

@glennawatson glennawatson closed this as not planned Won't fix, can't repro, duplicate, stale Jan 21, 2024
Copy link

github-actions bot commented Feb 5, 2024

This issue has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Feb 5, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

No branches or pull requests

2 participants