Click here to Skip to main content
15,887,027 members
Home / Discussions / C#
   

C#

 
AnswerRe: how to copy cheked nodes from a treeview to to new treeview? Pin
BillWoodruff2-Jan-12 14:10
professionalBillWoodruff2-Jan-12 14:10 
GeneralRe: how to copy cheked nodes from a treeview to to new treeview? Pin
JANARDHAN GURRAM2-Jan-12 21:40
JANARDHAN GURRAM2-Jan-12 21:40 
GeneralRe: how to copy cheked nodes from a treeview to to new treeview? Pin
BillWoodruff2-Jan-12 23:04
professionalBillWoodruff2-Jan-12 23:04 
GeneralRe: how to copy cheked nodes from a treeview to to new treeview? Pin
JANARDHAN GURRAM2-Jan-12 23:49
JANARDHAN GURRAM2-Jan-12 23:49 
GeneralRe: how to copy cheked nodes from a treeview to to new treeview?<SOLVED> Pin
JANARDHAN GURRAM3-Jan-12 1:06
JANARDHAN GURRAM3-Jan-12 1:06 
GeneralRe: how to copy cheked nodes from a treeview to to new treeview? Pin
BillWoodruff3-Jan-12 2:51
professionalBillWoodruff3-Jan-12 2:51 
GeneralRe: how to copy cheked nodes from a treeview to to new treeview? Pin
JANARDHAN GURRAM5-Jan-12 18:17
JANARDHAN GURRAM5-Jan-12 18:17 
GeneralRe: how to copy cheked nodes from a treeview to to new treeview? Pin
BillWoodruff5-Jan-12 22:38
professionalBillWoodruff5-Jan-12 22:38 
Glad you are making progress on your solution !

Obviously, you've come up on the issue of performance, and here a few comments I hope you will find useful:

By the way: have you explored all the possible uses in your scenario of TreeNode.Clone() ... which .... from MSDN: "Copies the tree node and the entire subtree rooted at this tree node." ... ?

0. is there any way you can limit the update to some user-initiated update (i.e., make it a batch operation), which of course may mean you'd have to tolerate a mis-match visually between the two TreeViews, assuming both are displayed at the same time.

If you can "get away with that," then I'd disable the second TreeView anytime it was not synchronized, after some change had been made in the primary TreeView, but the user had not initiated an update.

1. however, if it is an absolute requirement that checking any TreeNode results in immediate changes in the second TreeView: then there are several ideas to explore:

a. since you can get an Event for any TreeNode CheckState changed: and having access to the changed Node also gives you access to its Parent property: does that give you enough information to do a partial update ?

b. whether the FullPath property of a TreeNode could be useful here ? I doubt it, since the WinForms TV gives you no useful methods to use that FullPath to directly get at TreeNodes (by, for example, using only part of the FullPath returned string).

2. view virtualization (showing only what you need to show as updated): I think there may be an example on here on CP of a TreeView supporting "virtual screen update" which means changes are made as they are required to be displayed: while I doubt that's relevant here, at least you might check it out ... for ideas.

3. flatlist: the third-party commercial TreeView I use (Lidor Systems IntegralUI TreeView) maintains a flattened list of all Nodes in depth-first order, which makes operations like the kind of updates you are looking at very much easier: and many other features including "virtualization of view." The WinForms TreeView, by comparison, is a "toy." Yes, that's a recommendation Smile | :) ... and no I don't work for Lidor.

a. on StackOverFlow you'll some good examples of how to create a flattened TreeView List of Nodes, based on ideas of Eric Lippert influenced by ideas of Wes Dyer: the method uses a stack to avoid the high performance/memory costs of true recursion. Check out this thread I started on SO a long time ago: [^].

4. finally, if immediate synchronization of both views here is the goal: re-consider Luc Patyn's suggestion to use your own tree data structure, and map it as needed to "views."

good luck, Bill
"It is the mark of an educated mind to be able to entertain a thought without accepting it." Aristotle

GeneralRe: how to copy cheked nodes from a treeview to to new treeview?<SOLVED> Pin
JANARDHAN GURRAM3-Jan-12 1:14
JANARDHAN GURRAM3-Jan-12 1:14 
QuestionProblem with Snake game in C# Pin
ori26942-Jan-12 3:20
ori26942-Jan-12 3:20 
AnswerRe: Problem with Snake game in C# Pin
Luc Pattyn2-Jan-12 3:42
sitebuilderLuc Pattyn2-Jan-12 3:42 
GeneralRe: Problem with Snake game in C# Pin
ori26942-Jan-12 4:31
ori26942-Jan-12 4:31 
Questionhow to preserve zero bebore number in csv file that opens on excell ? Pin
goldsoft2-Jan-12 0:23
goldsoft2-Jan-12 0:23 
AnswerRe: how to preserve zero bebore number in csv file that opens on excell ? Pin
Shameel2-Jan-12 2:18
professionalShameel2-Jan-12 2:18 
AnswerRe: how to preserve zero bebore number in csv file that opens on excell ? Pin
Richard MacCutchan2-Jan-12 3:35
mveRichard MacCutchan2-Jan-12 3:35 
GeneralRe: how to preserve zero bebore number in csv file that opens on excell ? Pin
Shameel2-Jan-12 3:44
professionalShameel2-Jan-12 3:44 
GeneralRe: how to preserve zero bebore number in csv file that opens on excell ? Pin
Richard MacCutchan2-Jan-12 3:57
mveRichard MacCutchan2-Jan-12 3:57 
QuestionHow to Convert Microsoft Office Word document to Image file such as Tiff? Pin
moslemB1-Jan-12 23:44
moslemB1-Jan-12 23:44 
QuestionRe: How to Convert Microsoft Office Word document to Image file such as Tiff? Pin
DaveAuld1-Jan-12 23:57
professionalDaveAuld1-Jan-12 23:57 
Questionmove from cells in dataGridview Pin
Nabawoka1-Jan-12 10:50
Nabawoka1-Jan-12 10:50 
AnswerRe: move from cells in dataGridview Pin
DaveAuld2-Jan-12 0:03
professionalDaveAuld2-Jan-12 0:03 
QuestionWebservice returns dataset as an xml Pin
kondapalli.santosh1-Jan-12 8:43
kondapalli.santosh1-Jan-12 8:43 
QuestionRe: Webservice returns dataset as an xml Pin
David C# Hobbyist.1-Jan-12 9:07
professionalDavid C# Hobbyist.1-Jan-12 9:07 
AnswerRe: Webservice returns dataset as an xml Pin
kondapalli.santosh1-Jan-12 10:25
kondapalli.santosh1-Jan-12 10:25 
GeneralRe: Webservice returns dataset as an xml Pin
kondapalli.santosh1-Jan-12 10:36
kondapalli.santosh1-Jan-12 10:36 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.