XAML syntax for binding to a certain ViewModel type in logical parent's DataContext #8709
MihaMarkic
started this conversation in
Ideas
Replies: 1 comment 1 reply
-
I used to want this feature too, but it's probably much more work than it's worth it, because:
|
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
Imagine a situation where you have parent and children, like the one below (pseudo AXAML), where ParentViewModel has RemoveCommand present that would remove the child.
While the syntax {Binding #Parent.DataContext.RemoveCommand} should work, there are some problems with it. First, you have to name the parent control, then child view can be hosted in different parent views etc.
I was thinking that something like $parent - but instead of searching for parent type, it'd be searching for parent's DataContext type - could be helpful.
XAML binding could be something like "{Binding $parentContext[ParentViewModel].RemoveCommand}".
Beta Was this translation helpful? Give feedback.
All reactions