I have 2 checkboxes. when one is checked, the other one must be checked and disabled. The code I have so far is like so
Xaml
<CheckBox x:Name="chkSABranches" Content="Apply to all branches" IsChecked="{Binding IsSABranches,ElementName=pgPageTemplate}" Grid.Row="0" Grid.Column="2"/>
In xaml.cs:
public static DependencyProperty IsSABranchesProperty = DependencyProperty.Register("IsSABranches", typeof(bool), typeof(pgAccounts), new PropertyMetadata(false));
public static DependencyProperty IsSAWarehousesProperty = DependencyProperty.Register("IsSAWarehouses", typeof(bool), typeof(pgAccounts), new PropertyMetadata(false));
public Boolean IsSABranches
{
get
{
return (bool)GetValue(IsSABranchesProperty);
}
set
{
SetValue(IsSABranchesProperty, value);
NotifyPropertyChanged("IsSABranches");
NotifyPropertyChanged("IsSAWarehouses");
}
}
public Boolean IsSAWarehouses
{
get
{
return (bool)GetValue(IsSAWarehousesProperty) || (bool)GetValue(IsSABranchesProperty);
}
set
{
SetValue(IsSAWarehousesProperty, value);
NotifyPropertyChanged("IsSAWarehouses");
}
}
This doesn't seem to work.. Could anyone please provide some guidance. thanks