Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WPF Binding
Message
From
28/10/2009 13:17:47
 
 
To
28/10/2009 12:09:50
Mike Sue-Ping
Cambridge, Ontario, Canada
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Title:
Miscellaneous
Thread ID:
01431906
Message ID:
01431941
Views:
45
Hi,

Bonnie is right - you will need to use a ValueConverter. If you scroll down this link far enough there's code for a 'VisibilityConverter' which should do what you need.
HTH,
Viv

>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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform