wpf - How to set the Control Visibilty of the Second Control depending on the Binding Value of the first -


i have custom wpf control i.e. combobox:wpftwcombobox. want set visibility using property called disableproviderselector.

the usual use of triggers not helping. scenario here when above control i.e. windowsformshost made visible or collapsed, want opposite happen below custom control.

<stackpanel grid.row="3" grid.column="2" height="25" orientation="horizontal"                  width="375" horizontalalignment="left">     <windowsformshost height="25" width="375">         <windowsformshost.style>             <style targettype="windowsformshost">                 <style.triggers>                     <datatrigger binding="{binding path=disableproviderselector}" value="true">                         <setter property="visibility" value="collapsed"/>                     </datatrigger>                     <datatrigger binding="{binding path=disableproviderselector}" value="false">                         <setter property="visibility" value="visible"/>                     </datatrigger>                 </style.triggers>                  </style>         </windowsformshost.style>         <commoncontrols:providerselectorcontrol requiredlevel="save" modifiedbyuser="providerselectorcontrol1_modifiedbyuser" x:name="providerselectorcontrol1"/>     </windowsformshost>     <combobox:wpftwcombobox x:name="portalproviderselector"                             selectedvalue="{binding selectedportalprovider}"                             itemssource="{binding path=portalproviderscollection}"                              displaymemberpath="fullname" width="350" height="25"                             requiredlevelflag="save">     </combobox:wpftwcombobox>             </stackpanel> 

can please me on how set visibility here?

so disableproviderselector bool when set true windowsformshost needs collapsed , combobox needs visible. reverse when bool false.

so far combobox concerned if bool true it's visible , when false it's collapsed. bind combobox directly property , use booleantovisibilityconverter

xaml:

<window.resources>   <booleantovisibilityconverter x:key="booleantovisibilityconverter" /> </window.resources> ... <combobox:wpftwcombobox x:name="portalproviderselector"                         width="350"                         height="25"                         displaymemberpath="fullname"                         itemssource="{binding path=portalproviderscollection}"                         requiredlevelflag="save"                         visibility="{binding disableproviderselector,                                             converter={staticresource booleantovisibilityconverter}}"                         selectedvalue="{binding selectedportalprovider}" /> 

Comments

Popular posts from this blog

c++ - Function signature as a function template parameter -

algorithm - What are some ways to combine a number of (potentially incompatible) sorted sub-sets of a total set into a (partial) ordering of the total set? -

How to call a javascript function after the page loads with a chrome extension? -