Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
WPF Binding
Message
De
28/10/2009 12:09:50
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
À
Tous
Information générale
Forum:
ASP.NET
Catégorie:
Windows Presentation Foundation (WPF)
Titre:
WPF Binding
Divers
Thread ID:
01431906
Message ID:
01431906
Vues:
102
I'm trying to toggle the visibility of a grid layout column. I've set the width to "Auto" and placed a control (listbox) inside the column with Visibility = Visible. In another grid column, I have a checkbox with IsChecked=False. I'd like to toggle the visibility of the first grid column based on the checked status of the checkbox.

I think that if I can set the listbox's Visibility based on the checkbox, the grid column would fix itself since its width is "Auto". I also figured that I should be able to use Binding to set the listbox's Visibility (based on the checkbox's IsChecked property). I've tried placing the following in the listbox's XAML:
<ListBox ... Visibility="{Binding ElementName=cbHideIO, Path=isChecked}" />
where the checkbox's name is cbHideIO, but, that does not work. Nothing happens when I check / uncheck the checkbox. I know this issue has to do with the fact that isChecked is "True" or "False" and that the Visibility property of the ListBox needs to be "Visible" or "Collapsed". The question is, how do I "convert" the types in pure XAML and not require any code behind (if that's possible).

TIA,
Mike
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform