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 

How to add Row

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



Joined: 02 Sep 2005
Posts: 1

PostPosted: Fri Sep 02, 2005 6:21 pm    Post subject: How to add Row Reply with quote

Hi,

im trying to add a row to my virtual tree, but im running into a road block.

from what i can tell it has to link to a dataset, and i dont want this feature.

i just want to add my own rows with there own children, something like the listview that is build into visual studio.
Back to top
View user's profile Send private message
Infralution



Joined: 28 Feb 2005
Posts: 5027

PostPosted: Sat Sep 03, 2005 4:49 am    Post subject: Reply with quote

Virtual Tree's programming model is a bit different to the standard .NET tee and list view. It is fully data bound - which means that you don't add visual display elements (such as rows or nodes) yourself. Instead you provide it with a data source (such as a list of objects) and it builds the visual display.

You use RowBindings to tell VirtualTree how to map the object properties to the display elements. The advantage of this approach is that VirtualTree handles all the mapping between user interface elements and you domain objects which otherwise you have to manage yourself. It also allows Virtual Tree to be very quick and resource efficient - because it only creates the user interface elements (rows) it needs to display the current data. With a standard TreeView or ListView you have to create the nodes or rows upfront. For a very large data source this can take a long time and consume a great deal of memory.

So to get back to the original question. You don't create a row. Instead you create a list of objects that you want to display. For instance you can create an ArrayList of FileInfo objects and set this as the data source for your tree. You use the VirtualTree designer (right click on the control) to auto-generate RowBindings for the FileInfo objects. This automatically creates Columns for each of the public properties of the FileInfo class and CellBindings which map the properties to columns (see the FileBrowser sample).

To add a new row you simple add another object to the ArrayList and tell VirtualTree to update its display by calling UpdateRows. ArrayList does not support the IBindingList interface which notifies clients of changes to a collection - so you have to call UpdateRows yourself. If your DataSource supports IBindingList (as DataSets do for instance) then you simply add your new object to the collection and Virtual Tree will be notified automatically and update the display.

Let us know if this answers your question.
_________________
Infralution Support
Back to top
View user's profile Send private message Visit poster's website
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