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

Eclipse formatter for java ending braces -

ruby - Nesting modules inside of a Rails eninge gem -

java - Are there any classes that implement javax.persistence.Parameter<T>? -