View previous topic :: View next topic |
Author |
Message |
Happs
Joined: 13 Jul 2011 Posts: 62 Location: Sydney, Australia
|
Posted: Thu Sep 05, 2013 2:26 am Post subject: Programmatically set check state of a tree row |
|
|
I have followed FileBrowser example to show check box in each row, I can get selected checked items by overriding:
Code: | SetValueForCell(Row row, Column column, object oldValue, object newValue) |
I need to check checked state of some specific rows when condition met. Not sure how to access the check box control for a given row, unable to see any relevant property from Row Members.
Any suggestions, thanks. |
|
Back to top |
|
|
Infralution
Joined: 28 Feb 2005 Posts: 5027
|
Posted: Thu Sep 05, 2013 11:15 pm Post subject: |
|
|
You need to remember that Virtual Tree is data driven - so generally you don't want to set user interface properties associated with rows directly. Instead you change the underlying data and then use the VirtualTree.UpdateRowData methods to get it to refresh if necessary. This ensure that the data model and the user interface are kept in sync. In the FileBrowser sample the folders that are checked are kept in an ArrayList - so you would add or remove the folders to this list and call UpdateRowData. _________________ Infralution Support |
|
Back to top |
|
|
Happs
Joined: 13 Jul 2011 Posts: 62 Location: Sydney, Australia
|
Posted: Tue Sep 10, 2013 1:00 am Post subject: |
|
|
Thanks for your suggestions.
I have resolved the issue using GetCellData() event:
Code: |
private void VirtualTreeControl_GetCellData(object sender, GetCellDataEventArgs e)
{
var myObj = e.Row.Item as MyObj;
if (myObj != null)
{
e.CellData.Value = myObj.Name;
if (e.Column == this.checkColumn)
{
e.CellData.Value = CheckedItems.Contains(myObj);
}
}
}
|
|
|
Back to top |
|
|
|