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

Perl - how to grep a block of text from a file -

delphi - How to remove all the grips on a coolbar if I have several coolbands? -

javascript - Animating array of divs; only the final element is modified -