I'm writing a desktop application which contains some user permission management, and therefore I'm building a segment to manage all the user permissions.
Before I start hardcoding all the different types of permissions into the UI, I was wondering if it is possible, to let WPF do this dynamically for me.
To be more specific, I have a model with the user and his permissions (each User has a Role) which looks like this:
public class Role
{
public enum Permission
{
None,
Read,
Write
};
public int id;
public string name;
public bool isAdmin;
public Permission Usermanagement;
public Permission Appointments;
public Permission Events;
and for each Permission in this class I want WPF to create a Template with the name and a comboBox to select the kind of permission. My first guess was to use a ListView/ListBox with a Template (that part is not the problem).
My question is how can I get the list of permissions as a source list for my Template, and afterwards how to bind the real object to it, so the right permission gets updated.
This is more a question about possibility, I could just hardcode my permissions and bind them one-by-one.
Aucun commentaire:
Enregistrer un commentaire