Hi,
Create a class and name it as per your naming conventions and write the following code in that class
public class Converters : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
Visibility rv = Visibility.Visible;
try
{
var x = bool.Parse(value.ToString());
if (x)
{
rv = Visibility.Visible;
}
else
{
rv = Visibility.Collapsed;
}
}
catch (Exception)
{
}
return rv;
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
return value;
}
}
Now in your XAML register this class
<Window x:Class="WpfTestApp.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525"
xmlns:converters="clr-namespace:yournamespace">
and add this converter as a resource
<Canvas.Resources>
<converters:Converters x:Key="boolToVis"/>
</Canvas.Resources>
I am giving a general example manipulate as per your requirement
<CheckBox Canvas.Left="96" Canvas.Top="19" Content="CheckBox" Height="16" Name="checkBox1" IsChecked="True"/>
<CheckBox Canvas.Left="96" Canvas.Top="54" Content="CheckBox" Height="16" Name="checkBox2" Visibility="{Binding ElementName=checkBox1,Path=IsChecked,Converter={StaticResource boolToVis}}"/>
Eg:
<datagridcheckboxcolumn binding="{Binding checked}" cellstyle="{StaticResource SingleClick}" visibility="{Binding Path=your database column name,Converter={StaticResource boolToVis}}">
Hope this helps.
Do let me know if you need any more details
Regards,
Sriman