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

linux - Does gcc have any options to add version info in ELF binary file? -

android - send complex objects as post php java -

charts - What graph/dashboard product is facebook using in Dashboard: PUE & WUE -