I'm trying to bind a set of RadRadioButtons to object properties: Here is the binding:
rbOwnOrRentOwn.DataBindings.Add("IsChecked", prevAddress, nameof(prevAddress.OwnOrRentOwn), false, DataSourceUpdateMode.OnPropertyChanged);
rbOwnOrRentRent.DataBindings.Add("IsChecked", prevAddress, nameof(prevAddress.OwnOrRentRent), false, DataSourceUpdateMode.OnPropertyChanged);
and here are the properties:
public bool OwnOrRentOwn
{
get => _ownOrRentOwn;
set
{
_ownOrRentOwn = value;
OnPropertyChanged(nameof(OwnOrRentOwn));
}
}
public bool OwnOrRentRent
{
get => _ownOrRentRent;
set
{
_ownOrRentRent = value;
OnPropertyChanged(nameof(OwnOrRentRent));
}
}
When I bind like this the object properties are not set when the buttons are selected/deselected.
The docs say that CheckState is one way to go but these enums are defined in System.Windows.Forms. This would mean I need to introduce the System.Windows.Forms into my business layer. Is this what I need to do or is there a better way.
This should be just a simple data binding.
Thanks
Carl