I looked at: Visibility Binding using DependencyProperty
and http://msdn.microsoft.com/en-us/library/system.windows.controls.booleantovisibilityconverter.aspx http://www.vistax64.com/avalon/240-no-checkbox-checkedchanged.html http://geekswithblogs.net/thibbard/archive/2007/12/10/wpf---showhide-element-based-on-checkbox.checked.aspx
I have some tabs I want to control their visibility from a checkbox i.e.
<TabItem Header="Preferences" Name="tabItem4"></TabItem>
Ideally I would do
<TabItem Header="Preferences" Name="tabItem4">
<DataTrigger Binding="{Binding ElementName=myCheckBox, Path=IsChecked}" Value="True">
<Setter Property="Visibility" Value="True" />
</DataTrigger>
</TabItem>
or some such but that is not correct syntax. What is easiest/correct syntax?
You can use the built-in BooleanToVisibilityConverter. Here's a working sample: