How to get Selected Row of WPF Devexpress TreeList in .NET? -
i new devexpress controls. have added treelist
control on form bind using entity. want selected column value i.e id
in .xaml file:
<dxg:treelistcontrol name="treelistcontacts" itemssource="{binding data, source={staticresource entityservermodedatasource2}}" autopopulatecolumns="true" horizontalalignment="left" margin="10,19,0,0" verticalalignment="top" height="317" width="180" focusablechanged="treelistcontacts_focusablechanged"> <dxg:treelistcontrol.columns> <dxg:treelistcolumn fieldname="company_id" readonly="true" width="30" visible="false"/> <dxg:treelistcolumn fieldname="companyname" readonly="true"/> </dxg:treelistcontrol.columns> <dxg:treelistcontrol.view> <dxg:treelistview showtotalsummary="true"/> </dxg:treelistcontrol.view> </dxg:treelistcontrol>
here, want selected company id? appreciated! thanks!
code-behind way:
can obtain value of specified cell contained within focused row via treelistview.getnodevalue method using following code snippet:
to learn more, see obtaining , setting cell values.
<dxg:treelistcontrol itemssource="{binding data, source={staticresource entityservermodedatasource2}}" autopopulatecolumns="true" horizontalalignment="left" margin="10,19,0,0" verticalalignment="top" height="317" width="180" focusablechanged="treelistcontacts_focusablechanged"> <dxg:treelistcontrol.columns> <dxg:treelistcolumn fieldname="company_id" readonly="true" width="30" visible="false"/> <dxg:treelistcolumn fieldname="companyname" readonly="true"/> </dxg:treelistcontrol.columns> <dxg:treelistcontrol.view> <dxg:treelistview showtotalsummary="true" x:name="treelistview"/> </dxg:treelistcontrol.view> </dxg:treelistcontrol> //... object id = treelistview.getnodevalue(treelistview.focusednode, "company_id");
mvvm way:
can define focusedrow property in viewmodel , bind treelistview.focusedrow property.
Comments
Post a Comment