Don't like ads? PRO users don't see any ads ;-)
Guest

Untitled

By: a guest on Apr 28th, 2012  |  syntax: None  |  size: 0.57 KB  |  hits: 16  |  expires: Never
download  |  raw  |  embed  |  report abuse  |  print
Text below is selected. Please press Ctrl+C to copy to your clipboard. (⌘+C on Mac)
  1. c# Using TreeView control in SplitContainer to change the content
  2. interface ISettingPanel
  3. {
  4. SettingContext Context{get;set;}
  5. }
  6.  
  7. public BasicSettingPanel:Panel,ISettingPanel
  8. {
  9. ....
  10. }
  11.  
  12. public void InitTreeView
  13. {
  14. var node=new TreeNode();
  15. node.Tage=new BasicSettingPanel();// or you can set the type to create the panel later
  16. treeView.Nodes.Add(node);
  17. }
  18.  
  19. public void AfterNodeSelected()
  20. {
  21. _currentPanel=null;
  22. var selectedNode=treeView.SelectedNode;
  23. var panel=selectedNode.Tag as Panel;
  24. if(panel!=null)
  25. _currentPanel=panel;
  26. (_currentPanel as ISettingPanel).Context=this.Context;
  27. }