I have xaml that lookes like this
<ListBox> <ListBox.ItemTemplate> <DataTemplate> <StackPanel> <TextBlock Text='{Binding Name}' /> <StackPanel Orientation='Vertical' x:Name='contentPanel' > Content goes here... </StackPanel> </StackPanel> </DataTemplate> </ListBox.ItemTemplate>
The listbox binds to an object with a bool property called ShowContent. How do I get silverlight to hide the contentPanel if the object with ShowContent is false?
Write a BoolToVisibility IValueConveter and use it to bind to the Visibility property of your contentPanel
You can find a BoolToVisibility pretty easy anywhere.
Check IValueConveter if you are new to that. http://msdn.microsoft.com/en-us/library/system.windows.data.ivalueconverter.aspx