using Entity Framework (C#) I have a User class which has ONE:MANY mapping to the UserRight class (simply, user has a set of rights). Each right is identified by a string. And now, because the maximum number of possible rights is finite (<10) I’d like to have 10 CheckBoxes and edit the subset of rights for a given user manually.
What is the nice way to do it?
James
Create a
RightViewModelclass to contain user rights:Create a similar class for your user, containing a member
Rightsof typeObservableCollection<RightViewModel>.In you XAML, use an
ItemsControl:And a template definition:
Mode=TwoWaymakes the binding update yourRightViewModelinstance.Define the
ItemsControl‘sItemsPanelif you need to display your checkboxes with a different layout.Finally set your user as the
DataContextof your container.