wpf - How to pass the object reference of parent User Control to ViewModel using xaml? -


I have a user control, we say that the textbox page and it is associated with ViewModel, TextboxPageViewModel. I need to get the TextboxPage reference in TextboxPageViewModel.

i.e.

  & lt; Button x: name = "btnCustomer" command = "{Binding CustomerCommand}" CommandParameter = "{binding ...}" />   

How can I bind to the context of UserControl, TextboxPage in xaml?

This will work in your case:

  & lt; Button x: name = "btn client" command = "{binding client command}" commandpalmter = "{binding relative saras = {relative serous FindAncestor, ancestor type = {x: type UserControl}}}" />  < / Pre> 

Cheers!

Comments