How to set a VM to a UserControl #17032
Closed
ArchieCoder
started this conversation in
General
Replies: 2 comments 5 replies
-
cc @nickrandolph, @eriklimakc |
Beta Was this translation helpful? Give feedback.
5 replies
-
Thank you for the detailed explanations. I will think which way I prefer: settting the DataContext in the constructor OR use Binding + VM as a property. I will probably switch to Binding. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Uno navigation system is well done with a pair of View - VM. However, if a page is more complex, UserControls are useful.
As suggested here https://discord.com/channels/1182775715242967050/1182775715729526908/1248333691655032892, I tried this in my sample app
BindingBug.zip, but the end result is the DataContext does not propagate to the UI, so none of the binding works.
The workaround is to set the DataContext directly in the constructor of the UserControl.
Beta Was this translation helpful? Give feedback.
All reactions