I am using WPF checkListBox And I want to populate its elements with all properties of the class given below. And I have a class named Person
namespace MyProject
{
public class Person
{
public enum PersonFields
{
PersonPermission1,
PersonPermission2,
}
bool _personPermission1;
bool _personPermission2;
public bool PersonPermission1
{
get
{
return _personPermission1;
}
set
{
if (_personPermission1!= value)
{
_personPermission1= value;
}
}
}
public bool PersonPermission2
{
get
{
return _personPermission1;
}
set
{
if (_personPermission2!= value)
{
_personPermission2= value;
}
}
}
}
}
I want to populate a checkListBox with its Properties dynamically. as in given image.
Yeah I got my answer...
chkListBoxPerson.ItemsSource = typeof(Person).GetProperties();
chkListBoxPerson.DisplayMemberPath = "Name";
Here chkListBoxPerson is the name of my CheckListBox.