Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
WPF Binding
Message
From
28/10/2009 13:34:16
Mike Sue-Ping
Cambridge, Ontario, Canada
 
 
General information
Forum:
ASP.NET
Category:
Windows Presentation Foundation (WPF)
Title:
Miscellaneous
Thread ID:
01431906
Message ID:
01431949
Views:
31
Phew, I looked all over the link Bonnie gave me, could not find any reference to a "visibility" converter and thought I was going nuts. Thanks for the new link. Unfortunately, it has to be done in code behind, right? I was hoping that there was some way to have it all in the XAML.

Mike

>>Hi Viv,
>>
>>I'm assuming that when you say "this link" you're referring to the one Bonnie provided?
>
>Nah. I was referring to the link I forgot to add :http://www.scip.be/index.php?Page=ArticlesNET22 :-{
>Sorry.....
>
>>
>>As for needing a "valueconverter", I figured that from the start, hence my question on how to "convert" the values :) Thanks for confirming this.
>>
>>
>>>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