I have a WPF DataGrid with a few radio button columns and a couple of textbox columns.
All columns are DataGridTemplateColumns so I can customize the string display formatting. (Not sure if this has any bearing on anything.)
There are two columns with radio buttons that are supposed to be grouped together to allow the user to select one, or the other.
In the view model behind a row, there is code that generates a unique groupname for the pair of radio buttons so that each row has its own set of mutually exclusive options.
The problem is, it seems that the DataGrid doesn't instantiate the row's viewmodel until a textbox is activated. That's when the constructor is triggered. Until that point, there is no unique groupname so a user can select both radio buttons. Once the constructor runs, the radio buttons behave properly.
Is there a way to force the viewmodel to be instantiated as soon as the DataGrid displays the new row?