-
Notifications
You must be signed in to change notification settings - Fork 674
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
Binding not triggered from nested UserControl #7298
Comments
this is the project it can be reproduced |
x:Bind doesn't use a DataContext, it uses your control as a starting point for searching. While Binding uses the element's DataContext. Perhaps it's all about the missing this.InitializeComponent(); in the second control? |
ok i need to use Binding not x:bind in the nested control how can make it work then ? also when i inspect the local:ControlLevel2 datacontext in the debugger it's same as in the parent actually |
i have added another full blown usercontrol at level2 to make sure this.InitializeComponent(); is called but the issue remains, so there is an issue between level 1 and level 2 usercontrol |
Update: if i add PropertyChangedCallback for 'ControlLevel2 NestedControl' it does fire but the datacontext for dp i always null. |
Try |
nope, does not make any difference |
soon it's gonna be birth day of this issue and nothing has been done. |
bump |
Describe the bug
For some reason when 'Binding' does not fire in the nested usercontrol but when i change it to x:Bind it does work. It also works fine from top level usercontrol.
page code behind
view model
usercontrol level 1 xaml
usecotnrol level 2 code behind
level 2 usercontrol only code behind
Steps to reproduce the bug
just open the project click on Neste ctrl binding tabl and see that the "Property 2 txt" is not showing up
Expected behavior
expected to see this (works fine with x:bind)
but i see this (when used binding)
Screenshots
NuGet package version
WinUI 3 - Windows App SDK 1.1.1
Windows app type
Device form factor
Desktop
Windows version
Windows 11 (21H2): Build 22000
Additional context
No response
The text was updated successfully, but these errors were encountered: