wpf - Binding to a Dependency Property of UserControl -


i have wpf user control has dependencyproperty called ismultiselect. want show hide button in usercontrol xaml.

<button visibility="{binding ismultiselect, converter=....}" /> 

this user control has viewmodel assigned datacontext. above syntax gives me binding error due property not existing in view model.

how can fix error?

you can target usercontrol in different ways in binding.

one solution find setting relativesource this:

<button visibility="{binding ismultiselect,      relativesource={relativesource ancestortype={x:type usercontrol}},     converter=....}" /> 

Comments

Popular posts from this blog

php - Why I am getting the Error "Commands out of sync; you can't run this command now" -

ruby - Nesting modules inside of a Rails eninge gem -

Eclipse formatter for java ending braces -