I am using DevExpress TreeListControl:
void TreeListView_FocusedRowChanged(object sender, FocusedRowChangedEventArgs e) {
string val;
PropertyInfo[] properties = e.NewRow.GetType().GetProperties();
foreach (PropertyInfo item in properties) {
string x = item.Name;
if (x == "Id") {
var barProperty = item.GetType().GetProperty("Id");
if (barProperty != null) {
object[] obj = new Object[0];
val = item.GetValue(sender, obj) as string;
}
}
}
}
How to get selected row value?
It is not needed to use reflection at all. You can use the TreeListView.FocusedNode property and the TreeListView.GetNodeValue method:
object id = treeListView.GetNodeValue(treeListView.FocusedNode,"Id");