Infralution Support Forum Index Infralution Support
Support groups for Infralution products
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Programmatically set check state of a tree row

 
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support
View previous topic :: View next topic  
Author Message
Happs



Joined: 13 Jul 2011
Posts: 62
Location: Sydney, Australia

PostPosted: Thu Sep 05, 2013 2:26 am    Post subject: Programmatically set check state of a tree row Reply with quote

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
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Thu Sep 05, 2013 11:15 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
Happs



Joined: 13 Jul 2011
Posts: 62
Location: Sydney, Australia

PostPosted: Tue Sep 10, 2013 1:00 am    Post subject: Reply with quote

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
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    Infralution Support Forum Index -> Virtual Tree Support All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group