I have started the process of creating a Kryptonized version of the TreeView control. As with many of the Krypton controls in the Toolkit it works by using the custom drawing ability of the standard TreeView control. So it will not have any new functionality but should draw in a manner consistent with the rest of the Krypton controls.

So far I have implemented drawing the node text and the tree plus/minus nodes and lines. You can see two examples below, the first using the Office 2010 Blue palette and the second the professional palette.

9 Responses to “KryptonTreeView Lines”

  1. jkr Says:

    looking nice… great to see that you’ve started adding controls :)

  2. Marco Pozzati Says:

    It would be really nice (and very very important for me) if you could add the possibility to add a text with different font next to the node label, like Outlook does next to mail folder to display how many mails there are. Thanks!

  3. Hitesh Says:

    Pl add radio and checkbox button. like IE adv setting options

  4. Cocotteseb Says:

    Really nice !

    How does it look with 2007 themes ? I think it is the most difficult theme to apply to the treeview
    It is really nice to see you were able to change the – + icons of the treeview. I’m curious how do you have achieved this !

    Finally are we still able to custom draw the nodes ?

  5. Phil Wright Says:

    Cocotteseb:

    I override all the node drawing so I have to draw the plus/minus image and also the lines myself at the correct indentation.

    Hitesh:

    I will be adding the checkbox drawing with the ability to override the images shown.

    Marco Pozzati:

    I hope to add the ability to have a second string drawn in a different text/font etc.

  6. Rich Says:

    Looks great… If you are taking requests:

    1) add a node enabled property.
    2) allow for nodes with or without check boxes.
    3) allow for nodes without images to not draw empty space.
    4) are tri-state check-boxes useful?

  7. Tester Says:

    Hi,

    It’s look very great :D
    Could we select multiple nodes at once?

  8. Pradeep Says:

    Please Implement DataSource for the treeview control

  9. Pradeep Says:

    Please Implement Datasource to be filled like the below:

    public static void SetDataSource(this TreeView tvw, string RootName, Object DataSource, string ValueMember, string DisplayMember, object NodeToSelect = null, Control[] ControlsToClear = null)
    {
    tvw.BeginUpdate();
    tvw.ClearDataSource(ControlsToClear);

    TreeNode root = new TreeNode(RootName) { Name = “Root” };
    tvw.Nodes.Add(root);

    CurrencyManager currencyManager = (CurrencyManager)tvw.BindingContext[DataSource];
    if (currencyManager.Count > 0)
    {
    IList innerList = currencyManager.List;

    PropertyDescriptor pdDisplay = currencyManager.GetItemProperties()[DisplayMember];
    if (pdDisplay == null) { MsgBox.Error(“Invalid Display Member: ” + DisplayMember, “Unable to set Datasource”); return; }

    PropertyDescriptor pdValue = currencyManager.GetItemProperties()[ValueMember];
    if (pdDisplay == null) { MsgBox.Error(“Invalid Value Member: ” + ValueMember, “Unable to set Datasource”); return; }

    foreach (object record in innerList)
    {
    string Text = pdDisplay.GetValue(record).ReturnEmptyIfNull();
    string Value = pdValue.GetValue(record).ReturnEmptyIfNull();

    TreeNode childNode = new TreeNode(Text) { Name = tvw.setName(Value), Tag = record };
    root.Nodes.Add(childNode);
    }
    }
    tvw.EndUpdate();
    tvw.Format();

    if (NodeToSelect != null) { tvw.SelectNode(NodeToSelect.ToString()); tvw.Focus(); }

    }

Leave a Reply