BitKFu's suggestion of using the GroupName
property will work, but there is a caveat. If you use group names, the scope for the RadioButton
groups becomes different.
If you create a UserControl
with 3 RadioButtons
all with GroupName
from "MyRadioGroup"
and put 2 such controls in your Window
, you will notice that all 6 RadioButton
act as if they are one group.
This is because when RadioButton
updates another RadioButton
, it usually sets up RadioButton
, which are children of its immediate parent DependencyObject
. However, when GroupName
used, the area expands to the root of Visual
( Window
, for example), and it will configure all RadioButton
under this root, which have the same GroupName
.
Therefore, sometimes it is better to simply separate them with an additional panel.
Joel B Fant
source share