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
Post a Comment