Click here to Skip to main content
15,880,392 members
Home / Discussions / C#
   

C#

 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Hila Berger31-Jan-18 23:14
Hila Berger31-Jan-18 23:14 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Eddy Vluggen31-Jan-18 23:23
professionalEddy Vluggen31-Jan-18 23:23 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Hila Berger31-Jan-18 23:48
Hila Berger31-Jan-18 23:48 
GeneralRe: What is the best way to practice unit testing in C#? Pin
Eddy Vluggen31-Jan-18 23:54
professionalEddy Vluggen31-Jan-18 23:54 
SuggestionRe: What is the best way to practice unit testing in C#? Pin
GregoryPres5-Feb-18 2:16
GregoryPres5-Feb-18 2:16 
QuestionPrevent adding of nodes to a TreeNode? Pin
primem0ver29-Jan-18 23:46
primem0ver29-Jan-18 23:46 
AnswerRe: Prevent adding of nodes to a TreeNode? Pin
Eddy Vluggen30-Jan-18 0:15
professionalEddy Vluggen30-Jan-18 0:15 
AnswerRe: Prevent adding of nodes to a TreeNode? Pin
BillWoodruff3-Feb-18 7:03
professionalBillWoodruff3-Feb-18 7:03 
Before I switched to using the Integral UI TreeView (Lidor Systems) [^], I used the following strategy to wrap the native WinForm TreeView in a way that let me do multiple selection:

1. a UserControl 'TreeXHost in which a WinForm TreeView 'WFTree is docked 'Full: 'WFTree is set to DrawMode 'OwnerDrawText. WFTree is declared 'private.

1.a when 'TreeXHost loads: the instance of the WinForm TreeView, is passed into a class 'TreeX, a pretty standard tree implementation.

2. in 'TreeX : event handlers are wired up for all the TreeView events

2.a a variety of Dictionaries and Lists were used to keep track of state and enable custom node (not inheriting from WF TreeNode) <=>to WF Node lookup:
public Dictionary<string, Node> AllNodes { set; get; }
public Dictionary<string, TreeNode> AllTreeNodes { set; get; }

public Dictionary<TreeNode, Node> TNodeToNode { set; get; }
public Dictionary<Node, TreeNode> NodeToTNode { set; get; }

public List<Node> DisabledNodes { set; get; }
public List<Node> SelectedNodes { set; get; }
So the basic idea was to isolate the WinForm TreeView completely, and present an API to use that behind the scenes inter-oped with the WinForm TreeView.

There were several reasons I chose not to sub-class the WF TreeView or TreeNode: of course, the issue/danger of exposing the "can't inherit from" TreeNodeCollection; the need to add some complex annotations to each node; ease of writing a serialize/deserialize facility, etc.

Yes, indeed. it got tricky: I ended up canceling every WF TV Event I could in the 'Before... Event Handlers; in the DrawNode Event you need to color the Node, or otherwise alter the TreeNode appearance based on its state. A design issue was whether disabling/enabling a Node with a non-empty TreeNodeCollection should recursively disable/enab;e every Node "under" it: I decided that was necessary. Not to mention issues of drag-drop Smile | :)

It got so tricky I went looking for a 3rd. party Treeview that I could afford ... and, I found the IntegralUI TreeView that was (and, still is) quite remarkable

Hope this is helpful.
«... thank the gods that they have made you superior to those events which they have not placed within your own control, rendered you accountable for that only which is within you own control For what, then, have they made you responsible? For that which is alone in your own power—a right use of things as they appear.» Discourses of Epictetus Book I:12


modified 4-Feb-18 1:09am.

GeneralRe: Prevent adding of nodes to a TreeNode? Pin
primem0ver3-Feb-18 22:52
primem0ver3-Feb-18 22:52 
GeneralRe: Prevent adding of nodes to a TreeNode? Pin
BillWoodruff5-Feb-18 18:34
professionalBillWoodruff5-Feb-18 18:34 
GeneralRe: Prevent adding of nodes to a TreeNode? Pin
primem0ver9-Feb-18 1:21
primem0ver9-Feb-18 1:21 
GeneralRe: Prevent adding of nodes to a TreeNode? Pin
BillWoodruff10-Feb-18 19:48
professionalBillWoodruff10-Feb-18 19:48 
QuestionHow to debug a WndProc function with multiple listviews ? Pin
Member 245846727-Jan-18 22:48
Member 245846727-Jan-18 22:48 
QuestionUpdate bound WPF controls from another thread Pin
je-wo25-Jan-18 7:14
je-wo25-Jan-18 7:14 
AnswerRe: Update bound WPF controls from another thread Pin
Richard Deeming25-Jan-18 9:02
mveRichard Deeming25-Jan-18 9:02 
AnswerRe: Update bound WPF controls from another thread Pin
Pete O'Hanlon25-Jan-18 22:41
mvePete O'Hanlon25-Jan-18 22:41 
QuestionEliminate LINQ for List<int> ? Pin
Member 245846724-Jan-18 19:50
Member 245846724-Jan-18 19:50 
AnswerRe: Eliminate LINQ for List<int> ? Pin
OriginalGriff24-Jan-18 20:16
mveOriginalGriff24-Jan-18 20:16 
SuggestionRe: Eliminate LINQ for List<int> ? Pin
Richard Deeming25-Jan-18 8:56
mveRichard Deeming25-Jan-18 8:56 
AnswerRe: Eliminate LINQ for List<int> ? Pin
BillWoodruff25-Jan-18 23:58
professionalBillWoodruff25-Jan-18 23:58 
GeneralRe: Eliminate LINQ for List<int> ? Pin
#realJSOP30-Jan-18 3:39
mve#realJSOP30-Jan-18 3:39 
GeneralRe: Eliminate LINQ for List<int> ? Pin
BillWoodruff30-Jan-18 6:07
professionalBillWoodruff30-Jan-18 6:07 
QuestionPaint Image on Form with BitBlt? Pin
Darla Fanbridge24-Jan-18 3:12
Darla Fanbridge24-Jan-18 3:12 
AnswerRe: Paint Image on Form with BitBlt? Pin
OriginalGriff24-Jan-18 4:05
mveOriginalGriff24-Jan-18 4:05 
QuestionSQL Connection string ignoring UserID Pin
Member 1240626023-Jan-18 2:02
Member 1240626023-Jan-18 2:02 

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.