Tree View Control for Silverlight.NET

This Tree view control developed by vectorlight.net for Microsoft's Silverlight technology is a dynamic and highly customizable control for displaying and navigating tree structures, such as a file system, web site, or any other nested structure both client-side or server-side.

To use the TreeView control you will need to add a reference to Liquid.TreeView.dll in your project.

How to Use the Tree Control In XAML Only

In your XAML ensure you have a reference to the Liquid.TreeView.dll in the UserControl tag at the top. To use the tree control on your Silverlight page and have it be populated completely in XAML:

<UserControl x:Class="TreeViewXAML.Page"
    xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:liquidTreeView="clr-namespace:Liquid;assembly=Liquid.TreeView"
    Width="400" Height="300">
     <Grid x:Name="LayoutRoot" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left">
          <liquidTreeView:Tree x:Name="officeTree" Canvas.Top="295" Canvas.Left="200" EnableCheckboxes="true" EnableDragAndDrop="false" Width="300" Height="151" Margin="4">
            <liquidTreeView:Node ID="0" Title="Offices" Icon="images/folder.png" IconExpanded="images/folderOpen.png">
                <liquidTreeView:Node ID="1" Title="Cheshire" Icon="images/folder.png" IconExpanded="images/folderOpen.png">
                    <liquidTreeView:Node ID="10" Title="Chester" Icon="images/doc.png" />
                    <liquidTreeView:Node ID="11" Title="Stockport" Icon="images/doc.png" />
                </liquidTreeView:Node>
                <liquidTreeView:Node ID="2" Title="Dorset" Icon="images/folder.png" IconExpanded="images/folderOpen.png">
                    <liquidTreeView:Node ID="20" Title="Bournemouth" Icon="images/doc.png" />
                    <liquidTreeView:Node ID="21" Title="Poole" Icon="images/doc.png" />
                    <liquidTreeView:Node ID="21" Title="Weymouth" Icon="images/doc.png" />
                </liquidTreeView:Node>
                <liquidTreeView:Node ID="3" Title="Devon" Icon="images/folder.png" IconExpanded="images/folderOpen.png">
                    <liquidTreeView:Node ID="30" Title="Plymouth" Icon="images/doc.png" />
                </liquidTreeView:Node>
                <liquidTreeView:Node ID="4" Title="Hampshire" Icon="images/folder.png" IconExpanded="images/folderOpen.png">
                    <liquidTreeView:Node ID="40" Title="Portsmouth" Icon="images/doc.png" />
                    <liquidTreeView:Node ID="41" Title="Southampton" Icon="images/doc.png" />
                </liquidTreeView:Node>
                <liquidTreeView:Node ID="5" Title="Lancashire" Icon="images/folder.png" IconExpanded="images/folderOpen.png">
                    <liquidTreeView:Node ID="50" Title="Blackburn" Icon="images/doc.png" />
                    <liquidTreeView:Node ID="51" Title="Lancaster" Icon="images/doc.png" />
                </liquidTreeView:Node>
            </liquidTreeView:Node>
        </liquidTreeView:Tree>
     </Grid>
</UserControl>
 

As you can see from above the tree and all it's child nodes are defined in the XAML which is great for simple, non-dynamic trees but what about displaying a structure from a web-service? That's where populating using C# comes in.

Populating a Tree Using C#

This method of populating a treeview control using C# is used for more advanced structures, such as those whose nodes cannot be determined at design time.

As before, ensure you have a reference to the Liquid.dll in the UserControl tag at the top, in our XAML we only declare the tree object:

<UserControl x:Class="TreeViewProgrammatic.Page"
    xmlns="http://schemas.microsoft.com/client/2007"
    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
    xmlns:liquidTreeView="clr-namespace:Liquid;assembly=Liquid.TreeView"
    Width="400" Height="300">
    <Grid x:Name="LayoutRoot" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left">
          <liquidTreeView:Tree x:Name="testTree" Canvas.Top="295" Canvas.Left="200" EnableCheckboxes="true" EnableDragAndDrop="false" Width="200" Height="151" Margin="4" Populate="Tree_Populate" Drop="Tree_Drop" NodeClick="Tree_NodeClick" />
    </Grid>
</UserControl>
 

In your C# code behind file you can refer to your Tree using testTree. The Silverlight Tree has several properties for controlling its behaviour, these can be found on the Tree Properties reference page.

using System;
using System.Collections.ObjectModel;
using System.Linq;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Media.Imaging;
using System.Windows.Shapes;
using Liquid;
namespace TreeViewProgrammatic
{
     public partial class Page : UserControl
     {
          private bool _rootBuilding = true;
          public Page()
          {
               InitializeComponent();
               testTree.BuildRoot();
          }
        void testTree_NodeCheckChanged(object sender, TreeEventArgs e)
        {
        }
          private void Tree_NodeClick(object sender, EventArgs e)
          {
               // TODO: Do something here when a node has been selected
          }
          private void Tree_Drop(object sender, TreeEventArgs e)
          {
               e.DropAction = Tree.DropActions.InsertBefore;
          }
          private void Tree_Populate(object sender, TreeEventArgs e)
          {
               ObservableCollection<Node> nodes = (sender is Tree ? ((Tree)sender).Nodes : ((Node)sender).Nodes);
               if (_rootBuilding)
               {
                    nodes.Add(new Node("0", "My Documents", true, "images/folder.png", "images/folderOpen.png"));
                    _rootBuilding = false;
               }
               else
               {
                    switch (e.ID)
                    {
                         case "0":
                        nodes.Add(new Node("1", "My Music", true, "images/folder.png", "images/folderOpen.png") { IsEnabled = false });
                              nodes.Add(new Node("2", "My Pictures", true, "images/folder.png", "images/folderOpen.png"));
                              nodes.Add(new Node("3", "My Videos", true, "images/folder.png", "images/folderOpen.png"));
                              nodes.Add(new Node("8", "Connect.xls", false, "images/xls.png"));
                              nodes.Add(new Node("6", "Latest.doc", false, "images/doc.png"));
                              nodes.Add(new Node("7", "Light.doc", false, "images/doc.png"));
                              nodes.Add(new Node("4", "Listing.pdf", false, "images/pdf.png"));
                        nodes.Add(new Node("5", "Update.pdf", false, "images/pdf.png") { IsEnabled = false });
                              break;
                         case "1":
                              nodes.Add(new Node("10", "Downloads", true, "images/folder.png", "images/folderOpen.png"));
                              nodes.Add(new Node("11", "Favourites", true, "images/folder.png", "images/folderOpen.png"));
                              nodes.Add(new Node("12", "Recent", true, "images/folder.png", "images/folderOpen.png"));
                              nodes.Add(new Node("13", "Track 01.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("14", "Track 02.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("15", "Track 03.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("16", "Track 04.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("17", "Track 05.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("18", "Track 06.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("19", "Track 07.mp3", false, "images/mp3.png"));
                              break;
                         case "10":
                              nodes.Add(new Node("16", "Track 04.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("17", "Track 05.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("18", "Track 06.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("19", "Track 07.mp3", false, "images/mp3.png"));
                              break;
                         case "11":
                              nodes.Add(new Node("13", "Track 01.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("14", "Track 02.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("15", "Track 03.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("18", "Track 06.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("19", "Track 07.mp3", false, "images/mp3.png"));
                              break;
                         case "12":
                              nodes.Add(new Node("14", "Track 02.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("15", "Track 03.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("16", "Track 04.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("18", "Track 06.mp3", false, "images/mp3.png"));
                              nodes.Add(new Node("19", "Track 07.mp3", false, "images/mp3.png"));
                              break;
                         case "2":
                              nodes.Add(new Node("13", "Image 1.gif", false, "images/gif.png"));
                              nodes.Add(new Node("14", "Image 2.gif", false, "images/gif.png"));
                              nodes.Add(new Node("15", "Image 3.gif", false, "images/gif.png"));
                              nodes.Add(new Node("16", "Image 4.gif", false, "images/gif.png"));
                              nodes.Add(new Node("17", "Image 5.gif", false, "images/gif.png"));
                              nodes.Add(new Node("18", "Image 6.gif", false, "images/gif.png"));
                              nodes.Add(new Node("19", "Image 7.gif", false, "images/gif.png"));
                              break;
                         case "3":
                              nodes.Add(new Node("13", "Video 01.mp4", false, "images/mp4.png"));
                              nodes.Add(new Node("14", "Video 02.mp4", false, "images/mp4.png"));
                              nodes.Add(new Node("15", "Video 03.mp4", false, "images/mp4.png"));
                              nodes.Add(new Node("16", "Video 04.mp4", false, "images/mp4.png"));
                              nodes.Add(new Node("17", "Video 05.mp4", false, "images/mp4.png"));
                              nodes.Add(new Node("18", "Video 06.mp4", false, "images/mp4.png"));
                              nodes.Add(new Node("19", "Video 07.mp4", false, "images/mp4.png"));
                              break;
                    }
               }
          }
     }
}
 

Please Note: You will need to ensure the image URL's are valid, the controls download zip contains the images you need here.

Example Silverlight Tree View:

Silverlight Tree Control  

Your Comments and Questions Answered

 You are not logged in. You need to login to post new messages, if you do not have a login you can register for free!

smithlan said:

Hello. I'm trying to set a node's icon at runtime. Works fine using Node.icon = string. However, if the new icon is, say, larger than the previous icon, the icon image gets cropped. I've poked around but I don't see any mechanism for specifying the size of a node's icon. Also, is it safe to assume that PNG is the only supported file type (e.g., jpgs not allowed)?
Thanks again!

06/26/2009 01:58
 
dan said:

Hi vlad,

The only method at the moment is GetNodeAtPoint() which retrieves the node at the provided point that you will get from your right-click mouse event handler. Thanks!

06/19/2009 11:18
 
dan said:

Hi mlagrange,

The main demo page contains the full treeview demo and source code that you can download, this should be enough to get you going. There are also many articles out there that can give you a simple introduction to ASP.NET/Silverlight development.

06/19/2009 11:16
 
dan said:

Hi borech,

There is a problem doing this in the current version. We are looking to make it more reliable in the next version. Thanks!

06/19/2009 11:13
 
dan said:

Hi ionutz.posea,

Yes, calling the Expand() method on a node causes the Populate event to be raised. Note this only occurs the first time the node is expanded, to force the Populate event to be raised each time you can set the ChildrenLoaded property to false. Thanks!

06/19/2009 11:12
 
dan said:

Hi smithlan,

Thanks for your bug report regarding the change of IsEnabled state that affects nodes in the tree. I will get it added to the fix list. Thanks!

06/19/2009 11:10
 
dan said:

Hi maarkkushere/Janardhan.V,

Databinding is not supported at the moment, you can only populate using XAML or on-demand methods. Thanks!

06/19/2009 11:08
 
dan said:

Hi smithlan,

Sure, there will be an event in the next version named 'Dropped' which will fire after the tree is updated which should cater for your requirements. Thanks!

06/19/2009 11:07
 
dan said:

Hi Julianjp,

Yes there is a bug here which we are investigating and will get fixed in the next version. Thanks!

06/19/2009 11:05
 
Janardhan.V said:

how to bind data programatically to treeview.

06/17/2009 05:54
 
vlad dara said:

Hi Dan,

Could you tell me please how can I retrieve the node if I make right-click on it and scroll?I don't want to refer to that node on it's relative position, because this could change....

Vlad

06/12/2009 05:57
 
mlagrange said:

Hi, Dan - I am primarily an Access developer, switching over to ASP.NET. Do you have a very basic documentation worked up for installation, creating a page, data binding, etc?

And in VB, maybe? :-)

Thanks; this looks like a really neat TreeView control

Mark

06/04/2009 06:40
 
borech said:

Hi Dan,

I can't make ScrollIntoPosition works. After changing selection and expanding node I just execute ScrollIntoPosition() but nothing happens. Should I do something more or adjust TreeView somehow or that is a bug?

05/26/2009 07:08
 
ionutz.posea said:

Hi Dan ,

So basically the Populate() event is triggered when you expand the node ,and then it is populated.
Is there a way to simulate form code this opening event?
I tried Expand ,but does not work.

05/20/2009 11:12
 
smithlan said:

Me again.
During relatively long-running operations (e.g., retrieve node children from server on Node expand), I disable the entire Silverlight UserControl via isEnabled=false, and then re-enable it when the operation is complete. However, when the UI (and treeView) is re-enabled, I'm seeing instances where individual Nodes within the tree appear to still be disabled (they're grayed out and exapnd/collapse doesn't work). The individual nodes can, however, be re-enabled by selecting them.

05/20/2009 08:50
 
maarkkushere said:

Just wondering if data binding is supported. I haven't been able to find anything like "ItemsSource".

05/18/2009 10:05
 
smithlan said:

Re: previous question, uh, duh, Nodes = children. Sorry.

Related question: Is there anything like a "postDrop" event so that operations can be performed against the changed tree structure (e.g., new child ordering) resulting from a "successful" drop? If you examine the tree contents within the drop event handler, the tree hasn't changed yet.

Thanks.

05/17/2009 02:48
 
smithlan said:

I need a way to iterate through a node's children, given only the parent of those children. However, I don't see a "children" getter on Node, only previous() and next() (which only help, I assume, if I'm starting with one of the children).

Stumped

Thanks.

05/16/2009 03:19
 
Julianjp said:

I can't see the drag and drop working for me? I came back to this site and looked at the treeview demo, and realised that the drag and drop is not working on the demo either?

05/15/2009 01:57
 
dan said:

Hi sadiq73,

Not in the current version, nodes can only be dragged and dropped within the same TreeView. Thanks!

05/14/2009 08:04
 
dan said:

Hi tonyelmore,

I sent you an email showing you how best to do this, but let me know if you need any further help!

05/14/2009 08:03
 
dan said:

Hi Julias,

Thanks for your comments. To discover the selected node you can use the TreeView.Selected property and to add child nodes to your node you use the Nodes collection like this:

PortsmouthNode.Nodes.Add(mychildNode);

Hope this helps!

05/14/2009 08:02
 
dan said:

Hi mikejoshdaly,

You will hit performance problems when adding lots of nodes as Silverlight is a little bit slow when it comes to adding elements to the visual tree. I think the main problem is the animation used to "fade-in" the nodes when you click expand.

I think the solution is to put an option in the TreeView to disable the fade-in animation, other than that I will need to do some tests of my own. Thanks!

05/14/2009 07:53
 
dan said:

Hi olivierm,

Thanks for the bug report. What we will do is set the Selected property to null when the Nodes collection is cleared which should fix the behaviour. Thanks again for your input!

05/14/2009 07:48
 
dan said:

Hi smithlan,

Yes, to expand a node you should use the Expand() method rather than the IsExpanded property. Thanks!

05/14/2009 07:35
 
dan said:

Hi chicadilly,

Thanks very much for the information, I can confirm there is a bug in the GetAllChecked() method which causes a problem with partially checked nodes. Hopefully this fix will be included in the next version which will be out soon. Thanks!

05/14/2009 07:31
 
sadiq73 said:

Can I drag and drop a node content (like 'Poole' in above image or multiple selected items ) anywhere on the page?

05/11/2009 08:44
 
tonyelmore said:

I apologize if this has been asked and answered.

I am trying to populate my tree view using a lazy loading method. So I initially populate the first couple of layers and then when a node is expanded I go fetch the children for that node. When the data is returned I populate the nodes collection.

However, the tree view update is not refreshed. I have tried several things including a refresh(), collapse() / expand()

I know the new items are in the nodes because I can perform a myTree.Get("myNodeName") to retrieve it.

Any direction would be appreciated,
Regards,
Tony

05/07/2009 06:05
 
Julias said:

Hello

Many Thanks for a great treeView control. I am serioulsy considering its use in a non commercial web site.

What is not obvious to me is how to Add a new Node, under an exsiting named Node in C#. (and how to remove it) If I have a named Node x;Name="PortsmouthNode", I cannot see any obvious method to Add Chidren Nodes to the PortsmouthNode.

I would also really like a Right Click, to show a context popup for 'Delete', 'Add', 'Properties' ect. Since Silverlight/Browser disables this, I guess there is no option of Middle (Wheel) Button events, to raise such a context menu. I could not see any. As an Alternative, I was going to check on the Selected Node, and use different Delete, Add, prperties buttons agains the Selecetd Node. But i note that the SelectionChange Event does not seem to return an ID. So its not obvious how I trigger/ discover the Selected Node.    

Cheers and Great Work
Jules

05/04/2009 07:09
 
mikejoshdaly said:

I'm having performance issues with adding nodes to the tree. I have a tree with one parent node and 266 child nodes. The actual adding of the child nodes in the code is fast. It only takes a few milliseconds to call BulkUpdateBegin, add the 266 nodes and BulkUpdateEnd. However it takes 1500 milliseconds for the framework to call all of the applytemplates on all of the various nodes and do all the rendering.    I tested this by recording the time just before my method returns after the call to BulkUpdateEnd and then taking an end time in the layout updated event. I was able to knock off 500 milliseconds by removing the expander by setting the haschildren property to false on all of the newly added 266 nodes. I tried removing the node icon and limiting the node title to 1 character, however those changes did not improve performance at all.

So that's baffeling to me, is silverlight really this slow, or is there something that we can do to improve this? The treeview in Windows Explorer doesn't even flinch at thousands of records. BTW, I tried placing 5000 treenodes in your treeview and it took so long to render that I had to go to lunch.

04/29/2009 09:32
 
olivierm said:

Here's second bug that I noticed. It is related to Drag & Drop. This bug occurs in the Drop event, with the TreeEventArgs argument. e.Target, in a particular case, contains a bad value. The bug can be reproduced as follows :

- Populate a tree with a couple of items, using 3 levels of depth (let's say hard disks that contain folders which contain files).

- Do a first drag and drop (move a folder from drive D in drive C). This will fire the Drop event, and e.Target will contain the node where the drop occured. Everything goes fine up to now.

- Then, simply click (do not drag, just a simple click) on the ICON of another node (let's say a file in some folder of drive E). This will fire the Drag event, and then the Drop event.

In the Drop event, e.Target, in that case, should be the same than e.Source since no dragging really occured (the mouse did not move). However, e.Target points on the OLD node where the previous drop occured. This results in unwanted behaviors (in my case, I was updating a list and changing hyerarchy of the elements using a PARENT property, and the clicked node began child of the wrong element).

If other people are experiencing the same problem, here is a workaround :
- Create a member variable that will record mouse position (Point structure). Let's call it myPoint.
- In the Drag event, reset the value of myPoint (myPoint = new Point()) *THIS IS REALLY IMPORTANT *, and set a flag to start monitoring the mouse position (eg : bMonitorMousePosition = true)
- In the MouseMove event of the tree, if monitoring of the mouse position is active (bMonitorMousePosition == true), update myPoint by calling e.GetPosition().
- In the Drop event, stop monitoring mouse move (bMonitorMousePosition = false). If myPoint still contains coordonates (0,0) it is because the mouse did not move, you can then cancel the Drop event (e.Cancel = true). If not, call myTree.GetNodeAtPoint(myPoint) to get the node where the drop occured.

Olivier

04/28/2009 02:15
 
olivierm said:

Hi Dan,

First of all, congratulations for this awsome suite of tools!!! I LOVE it, and it is really easy and intuitive to use!

I would like to submit you somes bugs I have encountered using the treeview intensively in the last month (and please forgive me for my english, my main language is french).


The first bug occurs in the SelectionChanged event of the Tree control, with the TreeEventArgs argument. e.Source is invalid if the Tree was cleared and populated again. Here's how to reproduce the bug :

- Create a Tree (single selection mode)
- Add items dynamically in the code (eg : myTree.Nodes.Add)
- Click on a node to select it (let's say its ID is "TEST")
- Call myTree.Nodes.Clear()
- Repopulate the tree with different data (note that no node is selected yet)
- Select a node (this fires the SelectionChanged event)

e.Source should be null in that case. However, it points on a node of the "old" nodes (the node with ID "TEST" that does not exist anymore).

I coded a workaround for now, which consists in keeping track manually of the previously selected node and the currently selected node by using my own variables instead of e.Source and e.Target. After calling myTree.Nodes.Clear(), I reset my variables to null.


Olivier

04/28/2009 02:03
 
chicadilly said:

Hi!

Working with this control, I made some observations about the checked attribute and I thought I'd post them if anyone cares...

By adding this treeview to a Silverlight control, I am able to embed this on an ASCX page that is loaded onto a ASPX page. I'm actually pretty excited - this is the first Silverlight implementation that we're using in a long running C# project. We're using this treeview as a convenient GUI to allow users to select locations to apply to an object in our application. When building a new object, it's okay to display an empty list of locations. However, when editing an existing object, we'd like to show the locations already selected.

When the ApplyChangesToChildren attribute is set to true, setting the nodes to IsChecked through code is not working. I found that the IsChecked attribute sticks if ApplyChangesToChildren is set to false. I also observed I could build the tree, set the checked nodes and then set the ApplyChangesToChildren to true - but if the nodes were collapsed, some strange behaviors occurred. If a parent node was set to IsChecked = null (a partial check), all collapsed children also received this attribute. It was kinda weird.

I was able to work around this by following these steps...

- Get the data
- Build the nodes including the 'IsChecked' attribute
- Expand all nodes
- At the end of the function to build the nodes, register a 'Loaded' event
- In the Loaded event, set the ApplyChangesToChildren attribute to true; and then repopulate the tree

Following these steps, I was able to get the behavior I wanted.

Just thought I'd post all of that in case it might help figure out where the attribute is causing conflicts.

Thanks so much!
Jennifer:)

04/24/2009 10:13
 
smithlan said:

Nevermind. Node.Expand() is the answer. :-)

04/21/2009 10:47
 
smithlan said:

Hello. I can't figure out how to expand a node programmatically.    Setting isExpanded to true doesn't seem to work.    Can someone please point me in the right direction?

Many thanks.

04/21/2009 10:28
 
chicadilly said:

Hi again!

I think the IsChecked problem might be related to setting the tree to ApplyChangesToChildren = true. I removed this attribute and saw the checkboxes populate with code. Interesting! :)

Another quick question, though... I set the treeview to allow partial checkboxes. After turning on this attribute, I'm getting an error on the GetAllChecked command.

I have the line written as such:
List<Node> checkedLocs = locationTree.GetAllChecked();

When partial checkboxes are not allowed in the tree, this command works beautifully. With the partial checkboxes turned on, the program halts at this line with the following error:

Nullable object must have a value.

Am I calling the command incorrectly? Is there a better way to go about this? hmmmm

Thanks so much!
chicadilly

04/21/2009 07:45
 
chicadilly said:

Hi again!

I think the IsChecked problem might be related to setting the tree to ApplyChangesToChildren = true. I removed this attribute and saw the checkboxes populate with code. Interesting! :)

Another quick question, though... I set the treeview to allow partial checkboxes. After turning on this attribute, I'm getting an error on the GetAllChecked command.

I have the line written as such:
List<Node> checkedLocs = locationTree.GetAllChecked();

When partial checkboxes are not allowed in the tree, this command works beautifully. With the partial checkboxes turned on, the program halts at this line with the following error:

Nullable object must have a value.

Am I calling the command incorrectly? Is there a better way to go about this? hmmmm

Thanks so much!
chicadilly

04/21/2009 07:37
 
dan said:

Hi Dan,

Firstly the documentation is a little limited at the moment, I will try to find the time to generate a CHM for these controls which should help you.

Your problem with the SelectionChanged event not firing correctly when using multi-select is a bug and one which should be resolved in the next version. The Selected property should be updated and the tests I've done show this, I will need to look into this in more detail.

The problem you have with ScrollIntoPosition() sounds like a bug which I need to investigate further, can you tell me if the node you are trying to move to is visible i.e. its parent(s) are expanded?

04/21/2009 01:18
 
dan said:

Hi shawnspeak,

Yes, we've just come across this and have added it as a bug to be fixed. Thanks for raising this!

04/21/2009 12:18
 
dan said:

Hi smims,

The IsContainer property of the node determines whether the node can have children. Note this is not enforced, for example you can add children to a node that has IsContainer=false, it is simply used for node sorting where the options include to group containers together. Hope this helps!

04/21/2009 12:17
 
chicadilly said:

Hi!

I really like this control! You guys captured everything we found lacking in the web version of the TreeView from the .NET framework. And, it's darn easy to implement!

That noted, I'm finding that we have a similar problem to what ericwang noted on 3/30/2009. I'm populating the treeview dynamically through C# codebehind. I do not get an error when I set node.IsChecked = true, however, the node does not display as checked. Even when I do a GetAllChecked() right after populating the tree, these nodes do not come back as checked. :(

Is there a workaround? Is there anything that I can do to get around this? When is the attribute getting dropped?

Thanks so much for all your help!
chicadilly

04/20/2009 02:18
 
danc said:

Hi Dan,

I am hoping you can help me out with another difficulty. I used your sample code to search for a node containg text. Once I have that node, I find that it's not always in view, so I added a call to ScrollIntoPosition similar to the following:

                _LastDestSearchResults = trvDest.Find(txtSearchDest.Text);

                trvDest.Selected = _LastDestSearchResults[_LastDestSearchIndex];
                trvDest.Selected.ExpandOut();
                trvDest.ScrollIntoPosition();    // This errors out with the message indicated below

However, I often get this error:

[Window Title]
Visual Studio Just-In-Time Debugger

[Main Instruction]
An unhandled exception ('Unhandled Error in Silverlight 2 Application Value does not fall within the expected range.
    at MS.Internal.XcpImports.MethodEx(IntPtr ptr, String name, CValue[] cvData)
    at MS.Internal.XcpImports.MethodPack(IntPtr objectPtr, String methodName, Object[] rawData)
    at MS.Internal.XcpImports.UIElement_TransformToVisual(UIElement element, UIElement visual)
    at System.Windows.UIElement.TransformToVisual(UIElement visual)
    at Liquid.Tree.ScrollIntoPosition()
    at CategoryMapper.Page.btnSearchSource_Click(Object sender, RoutedEventArgs e)
    at System.Windows.Controls.Primitives.ButtonBase.OnClick()
    at System.Windows.Controls.Button.OnClick()
    at System.Windows.Controls.Primitives.ButtonBase.OnMouseLeftButtonUp(MouseButtonEventArgs e)
    at System.Windows.Controls.Control.OnMouseLeftButtonUp(Control ctrl, EventArgs e)
    at MS.Internal.JoltHelper.FireEvent(IntPtr unmanagedObj, IntPtr unmanagedObjArgs, Int32 argsTypeIndex, String eventName)') occurred in iexplore.exe [6044].


I know the node exists so I think there is some issue within the ScrollIntoPosition function.
Any idea what could be causing this?

Best regards,

Dan C.

04/20/2009 09:33
 
danc said:

Hi Dan,

You have a great control here and I thank you for making this freely available. I am sure it's a lot of hard work.

I have been playing with it and it works well, but I have run into a few issues that probably have to do with my not fully understanding how to use this. Do you have any documentation on what the various events are and when they are called? I could not find anything and had to trial and error.

My main issue is that I have a tree with multiselect=true (though the issue occurs even if it's not multiselect). When a user selects a node and I am processing either the NodeClick or SelectiongChanged events, the Selected value is null and the SelectedNodes collection is empty. I realize that I can get the node that was just clicked in the event, but I would like to look at the entire list of selected nodes (for example, in some helper functions that update the status of various other buttons). Can you tell me when these are updated?

Again, thanks for this!

Dan C.

04/14/2009 02:55
 
shawnspeak said:

Thanks for the great treecontrol.. Looks like there might be a problem when a Node is dragged to the root level it is no longer able to be dragged.

04/13/2009 12:28
 
smims said:

What exactly is the 'bool container' on the Liquid.Node class?

Thanks,
SMIMS

04/08/2009 06:32
 
dan said:

Hi mardan,

Certainly, consider it done and in the next version. Thanks!

04/04/2009 01:11
 
dan said:

Hi rodiniz,

Thanks for your suggestion, I will look into this and see if we can get it added to the next version. Thanks!

04/04/2009 01:10
 
dan said:

Hi ericwang,

Thanks for bring this to our attention, I have added it as a bug and hopefully we can get it fixed soon!

04/04/2009 01:09
 
dan said:

Hi borech,

I agree it would be more useful to have more than one icon, we are looking to change the treeview to use templating. Thanks!

04/04/2009 01:06
 
dan said:

Hi Srini,

There is no built in functionality to do this, however you could, in your Drop event handler set e.Cancel = true.

The treeview will do nothing with the drag and drop itself, however also in the provided event arguments e are Source and Target properties which are the node being dragged (Source) and the node under the dragged node (Target).

I hope this helps you out!

04/04/2009 01:05
 
mardan said:

Hi,
it would be great, if there were one more event fired after dropping item has finished, so that it was much more simplier for updating underlaying objects (that are 'tagged' to a nodes).

04/02/2009 04:23
 
rodiniz said:

Hi..looks like you can only drag a node to a folder that has at least one children.
If the folder doesn't have any children, then its not possible to drag a node into it.

04/01/2009 09:04
 
ericwang said:

Hi Dan,
Your TreeView Control is so COOL! I Love it! But i have a trouble when i try to populated it completely in XAML. I tried to uss ' IsChecked="True" ' to pre-check some tree nodes and got an error of "AG_E_PARSER_BAD_PROPERTY_VALUE [Line: 29 Position: 82]. Can you give me some advise about it ?

03/30/2009 11:54
 
borech said:

Hi,

your TreeView control is a great and very useful. Thanks for it. One request from my side: please add possibility to add more than one icon for tree item. It would be incredibly useful.

03/23/2009 07:28
 
srinib said:

Hi Dan,

Firstly excellent controls. Thank you and your team. Is it possible to control the behaviour of Drag-Drop. I have a tree representation of Areas - Sub Areas - Positions. The Position nodes have position name (like Corridor_A) and name of person assigned to that position. So the node looks like Corridor_A : Joe Bloggs. When I drag this node to another sub area I want to move Joe Bloggs to the new position leaving the old position empty (unassigned). In other words if Corridor_C is the new position, after drag it should read Corridor_C : Joe Bloggs and Corridor_A will read just Corridor_A.

Before Drag:
Area_A
----SubArea_A1
---------Corridor_A : Joe Bloggs
----SubArea_A2
---------Corridor_C

After Drop:
Area_A
----SubArea_A1
---------Corridor_A
----SubArea_A2
---------Corridor_C : Joe Bloggs

This functionality is critical for my application and I am not sure how I can do this in the Drop event.

Thank you,
Srini

03/18/2009 08:56
 
dan said:

Hi WolveFred,

Yes these events exist on the Node object however they simly filter up though the structure to the top-level Tree object which handles the population. So the answer here, (the supported method) is to use the Populate event on the Tree object only for population. Thanks!

02/27/2009 06:24
 
WolveFred said:

Hi dan,

Thanks for the explanations. You have right understood what I wanted to do.

In fact I believe have understood that the events NodeExpanded, Populate, NodeIconMouseUp... are rightly working on a Tree object, but not on a Node object. I believe that it is a missed feature. But that's not really embarassing because that's work as the same way.

02/26/2009 07:12
 
dan said:

Hi WolveFred,

Sure, the NodeExpand event is called before a before the any processing has occured allowing you to stop the expand action if you like by setting e.Cancel = true. The NodeExpanded occurs after the call to populate the node has been made.

I think what you need to be doing is using the Populate event to populate children dynamically, the example on this page (Populating a Tree Using C#) shows how to do this. The Populate event is only fired when a node is expanded, I think this is what you need, but let me know if you want something different!

02/25/2009 01:47
 
WolveFred said:

Hi dan,

What is the purpose of the node's events : NodeExpand and NodeExpanded ? When I launch the node.Expand() method on one node, the program doesn't fire one of these two events. Same thing as when I click on the expand sign of the node (+), it doesn't fire the two events as I was waiting for.

Is it possible to intercept the operation of expanding a node ?

I'm adding that this node doesn't contain children. I would like to load these childrens when I click on the expand button. A dynamicall treeview so.

02/24/2009 08:10
 
dan said:

Hi,

Sure, the downloads page contains the latest control library files. Thanks!

02/20/2009 11:01
 
viral said:

Excuse me, Sir,

From where can i get Liquid.TreeView.dll file.?

02/20/2009 02:20
 
dan said:

Hi WolveFred,

This is true, hooking into the right mouse click involves javascript which as you may know results in incompatibilities with certain browsers such as Firefox. The solution presented here should only be for Silverlight apps that target IE. Thanks!

02/18/2009 04:25
 
WolveFred said:

Hi dan,

It's a web application of course. In fact, I understood why it didn't work : the right click works with Internet Explorer, but not correctly with Firefox ! That's wired... I'm looking for a solution...

02/18/2009 12:59
 
dan said:

Hi roland,

At the moment you cannot add UI items such as textbox, radio button etc to the node. However there is a standard Silverlight method call on all UI Elements (such as Node) that can be called and will calculate the absolute position:

Point position = mynode.TransformToVisual(RootVisual).Transform(new Point());

Where RootVisual is the element the calculation should be based on. You can pass this as null and you will get the coordinates from the top-left of your whole Silverlight app. Hope this helps!

02/17/2009 12:04
 
dan said:

Hi WolveFred,

Is your project running from a test page created by VS 2008 or from a web application? As if you use a test page then VS 2008 re-creates this each time you build your project which will delete any changes you made to it i.e. adding windowless="true".

02/17/2009 11:57
 
dan said:

Hi Dmitry,

It is only possible to do this at the moment using styles, however we will add a new property to allow you to control this in the next version of the controls library. Thanks!

02/17/2009 11:50
 
rolandschwarz said:

Hello,

I'm currently working on a diploma project where at one time I have to display a generated xml structure from a non at design time given xsd-Definition.

From the possible xsd-Definitions I have to consider different possible Inputs such as for example "choice" .

When presented with a choice element, the user has to choose one selection, and I would like to do this with a drop down box i.e. .

To get to the question : Is there a way to add items like a Textfield, radio button etc. as a Node ?
Or : Is it possible, to get screen positions for one selected Item to dynamically put the needed input control at that place ?

Thanks alot for your help !

greetings,

roland

02/16/2009 02:40
 
WolveFred said:

Hi dan,

About the problem of the context menu, I tried to use the param windowless="true", but that's not changing anything : when I right-click on the icon, it firstly shows the Configuration menu of Silverlight, and then when I click elsewhere, its shows the waited menu.

WolveFred

02/16/2009 04:20
 
borech said:

Hi
I'm trying to change font color of tree node text dynamically. I have one of the nodes and set it's Foreground to new SolidColorBrush(Colors.Red). It works, but only for unselected nodes: when user select node it's font color get back to black. Is it possible to set font color for all cases? Background color works fine both for selected and unselected nodes.

Regards
Dmitry

02/12/2009 01:55
 
dan said:

Hi WolveFred,

The right-mouse click can only be detected if your silverlight app is running with windowless="true" as follows:

<object data="data:application/x-silverlight," type="application/x-silverlight-2" width="100%" height="100%">
     <param name="source" value="ClientBin/RichTextBox.xap"/>
     <param name="onerror" value="onSilverlightError" />
     <param name="background" value="white" />
     <param name="windowless" value="true" />

     <a href="http://go.microsoft.com/fwlink/?LinkID=115261" style="text-decoration: none;">
     <img src="http://go.microsoft.com/fwlink/?LinkId=108181" alt="Get Microsoft Silverlight" style="border-style: none"/>
     </a>
</object>

Hope this helps!

02/11/2009 12:03
 
dan said:

Hi e.beckers,

This is not possible at the moment but we can certainly get this added as a feature request. Thanks!

02/11/2009 11:59
 
WolveFred said:

Hi dan,

I tried the Context Menu project and modified some older things.

But there is still a problem : when I right-click on a Node, it displays firstly the menu "Configuration Silverlight", and only after our context menu.

Would it be possible to disable the configuration menu of Silverlight ?

02/11/2009 01:27
 
WolveFred said:

Ok, there is a already a context menu. Thanks.

02/11/2009 12:59
 
WolveFred said:

Hi dan,

Is it possible to add a right click menu to each node ?

WolveFred

02/11/2009 12:41
 
e.beckers said:

Hi
Is it possible to have 2 or more icons on a tree node?
The reason i ask is that each of my tree nodes has a specific state (e.g. checked in/ checked out)
Since each node already has a thumbnail, I would like to visualize this state by using a 2nd icon

Regards

Erwin

02/10/2009 10:42
 
dan said:

Hi e.beckers,

Thanks for raising this, it certainly looks like a problem with the syncronization of the nodes collection with the UI. I will give this a try and let you know what I find. Thanks for taking the time to post!

02/04/2009 01:10
 
dan said:

Hi karlssonkatrin,

Apologies, after further digging the cursor hand is set in code, a new property will be put in place as I explained earlier in the next version. Thanks for your patience!

02/04/2009 01:07
 
e.beckers said:

Digging a bit further. The 4004 error also occurs when adding subnodes and other operations

I get the feeling that the problem occurs when you change /add multiple nodes at once.
So if i change the title / icon of 1 node, things work ok
but if i change the title/icon of 10 nodes then 4004 occurs

I also managed to get the following stack trace:
{System.ArgumentException: Value does not fall within the expected range.
    at MS.Internal.XcpImports.CheckHResult(UInt32 hr)
    at MS.Internal.XcpImports.Collection_AddValue[T](PresentationFrameworkCollection`1 collection, CValue value)
    at MS.Internal.XcpImports.Collection_AddDependencyObject[T](PresentationFrameworkCollection`1 collection, DependencyObject value)
    at System.Windows.PresentationFrameworkCollection`1.AddDependencyObject(DependencyObject value)
    at System.Windows.Controls.UIElementCollection.AddInternal(UIElement value)
    at System.Windows.PresentationFrameworkCollection`1.Add(T value)
    at Liquid.Node.SyncChildren()
    at Liquid.Node.BulkUpdateEnd()
    at SilverEvado.Modules.ContentTree.svc_GetTreeItemsCompletedSub(Object sender, GetTreeItemsCompletedEventArgs e)}

02/04/2009 02:40
 
e.beckers said:

I have a tab control with 3 tab-pages.
Each tabpage has a treeview control
Each treeview gets populated programmaticly in code by using the Nodes.Add() method
e.g.:
            Node node = new Node(idNode, name, hasChildren);
             node.ID = idNode;
             node.Icon = Utils.GetUriFor("Icons/" + treeItem.Thumbnail);
             node.ChildrenLoaded = false;
             parentNode.Nodes.Add(node);

This works great, but when i later on want to update one or more tree nodes
(e.g. change the icon and/or title) then i get the dreaded
silverlight unhandled exception
code: 4004
category: managedruntimeerror
message: ArgumentException:Value does not fall within the excepted range

The code to update the tree node is as follows:

void UpdateNode(int idNode, string newTitle, string newIcon)
{
        Node node = GetChildNode(treeCtl.Nodes, idNode);
        if (node == null) return;
        node.Title = newTitle;
        node.Icon = newIcon
}

Node GetChildNode(ObservableCollection<Node> nodes, int
{
        string id = nodeId.ToString();
        foreach (Node node in nodes)
        {
         if (node.ID == id)
         {
             return node;
         }
         if (node.HasChildren && node.ChildrenLoaded)
         {
             return GetChildNode(node.Nodes, nodeId);
         }
        }
        return null;
}


Any suggestions ??

02/04/2009 12:50
 
karlssonkatrin said:

Hi,
That will be great, thanks!

I'll tried to perform a workaround using styles for certain nodes but I encounter one problem.
How do I get rid of the 'hand' during mouse over?

02/02/2009 01:38
 
dan said:

Hi karlssonkatrin,

We can certainly add a property that allows certain nodes to be visable but not selectable which should work for your scenario, this we'll try to get done for the next version. The style for the node could be modified to remove the hand cursor, there are lots of great articles out there on applying custom styles which should help you. Thanks!

01/30/2009 11:22
 
dan said:

Hi Bache,

Glad your problem is fixed, Thanks!

01/30/2009 11:16
 
karlssonkatrin said:

Hi Dan,

Ok, I missunderstood.

I just don't want the user to be able to click on some of the nodes. Or just remove the hand that appears when the mouse is over and that the text gets a blue marker around/behind it.
So I'm using the treeview both as a menu but some nodes I just want to use to display plain text in. These nodes can be both parent nodes and child nodes, the parent nodes are added in xaml but the child nodes dynamically in C#.

Is this possible to achieve? Maybe through styles?

Thanks

01/29/2009 03:00
 
bache said:

Hi,

my problem (previous post) is solved. There was simply not enough Silverlight under my TreeView. I just added a couple of pixels and now everything works just great.

Thanks

01/28/2009 05:06
 
bache said:

Hi,

I have a page with a liquid treeView and EnableDragAndDrop="true". When I open the nodes, the verticalScrollbar appears just fine.
Whenever I take a node and go up, the treeview will scroll along.
If I go down with a node, the treeview DOES NOT scroll down.
Is there a setting/property I'm not setting well?

<liquid:Tree x:Name="MyRouteTree" EnableDragAndDrop="True" ApplyCheckChangesToChildren="True" EnablePartialCheckboxChecks="True" EnableCheckboxes="True" VerticalAlignment="Top" Margin="0,5,0,0" VerticalScrollBarVisibility="Auto" Grid.Row="3" Canvas.ZIndex="1" Width="315" />

Thanks

01/28/2009 02:10
 
dan said:

Hi,

Apologies, my mistake, by setting the parent to IsEnabled=false, all children become disabled, this is the behaviour of Silverlight and not the TreeView. What aspect of the parent node do you wish to keep disabled whilst the children are enabled? If it is just the ability to expand/colapse then we could get a property implemented to handle this.

01/23/2009 09:48
 
karlssonkatrin said:

Hi,
I saw that you fixed the bug I wrote about earlier in version 5.1.1 "Setting the IsEnabled property of a Node now works correctly and disables the node, but not its children"

But I can't get it to work. In xaml I have the following parent node:

<Liquid:Node ID="2" Title="MyNode" IsExpanded="False" x:Name="node_MyNode" Icon="images/folder.png" IconExpanded="images/folderOpen.png" FontFamily="Verdana" IsEnabled="False"/>

In c# I add a child node to this node which has the property IsEnabled=true.

But its still not possible to click on the child node. I'm using release 5.1.5

Any suggestion?

01/23/2009 01:52
 
dan said:

Hi avs888,

Good point! The focus logic in the TreeView/Node is not quite perfected at the moment and is something which will be addressed in the next version. Certainly there should be a way to apply focus to individual nodes and also the editing textbox. Thanks for raising this!

01/14/2009 02:30
 
avs888@hotmail.com said:

Hi Dan, me again :-)
Is there a way to send focus into the textbox when editing a node? Or... Is there a way to get to "ElementInput" at all?
Or... It seems more natural to go into edit mode with the focus in the node instead having to sniper-click it. What do you think?

01/14/2009 12:18
 
dan said:

Hi Kobus,

Not at the moment but this is a good suggestion that we will get implemented in the next version. Thanks!

01/12/2009 10:33
 
Kobus said:

Is there a way to programmatically scroll the tree up/down, that would have the same effect as clicking on the up or down arrows of the scrollbar?

I can't seem to find a property to access the scrollbar.

01/12/2009 02:23
 
dan said:

Hi swidom,

Thats right, only relative URL's can be used. We'll implement a fix to enable both absolute and relative URLs in the next version. Thanks!

11/29/2008 08:06
 
swidom said:

I was wondering if it is possible to programmatically control the images used for the Icon and the IconExpanded. It seems that I cannot use an absolute path to the images I want used and the relative path cannot use "../" dot-dot notation. I am trying to create a non-homegenous tree where each node is "symbolized" based upon the icons used.

11/24/2008 11:06
 
dan said:

Hi karlssonkatrin,

The correct method for programmatically selecting nodes is to set the node.Selected = true and also to add the node to the SelectedItems collection like this:

tree.SelectedItems.Add(node);

Hope this helps!

11/18/2008 12:32
 
dan said:

Hi,

Thanks for reporting this, it sounds like a bug which will get looked into soon and a fix implemented. Thanks!

11/10/2008 04:17
 
karlssonkatrin said:

Hi,
When i use the ClearSelected() method on my treeview control it works fine on the nodes I selected manually. But if I set a node to Selected=true in code and in a later stage run ClearSelected on the whole treeview the node dosen't get deselected. Is it suppose to or is it a bug?
Any other suggestion on how to solve this issue?

11/10/2008 10:48
 
dan said:

Hi inter-log,

After a bit more digging, there doesn't seem to be a problem with setting the Checked state in C#. I have an example here or programmatic node creation with Checked state set:

testTree.Nodes.Add(new Node("0", "Root", true) { Checked = true });
testTree.Nodes[0].Nodes.Add(new Node("1", "Child 1", false));
testTree.Nodes[0].Nodes.Add(new Node("2", "Child 2", false) { Checked = true });
testTree.Nodes[0].Nodes.Add(new Node("3", "Child 3", false));

Hope this helps!

11/07/2008 09:11
 
dan said:

Hi,

Thanks for letting us know about this, we will fix the NodeMouseOver event to work for all nodes, selected and unselected. Thanks!

11/06/2008 03:44
 
rshelby said:

Hi, Thanks for all your hard work on these great controls.

The "Node.NodeMouseOver" doesn't fire on a node if it is selected. I saw there is an event called "NodeTextMouseDown", so I'm wondering if there is a "NodeTextMouseOver" event planned in the future. In the meantime, is there a way to work around this issue using version 5.1.1?

Thanks again!

11/06/2008 06:39
 
dan said:

Hi ckychavez,

Thanks for the post, sounds like a bug. I will get it added to the list of fixes for the next version, thanks very much!

11/06/2008 02:50
 
ckychavez said:

I have tried your treeview for a silverlight application and I have used the version 5.1.0.0.



Working fine except for one thing, when I expend one branch of the tree, it seems that the event that is launched by default is the “NodeCheckChanged”.

And it will launch for every single node underneath the branch you just open. And after having launched each node of the branch for NodeCheckChanged, it will finally launch the “NodeExpanded” events.



Is it a bug or was it design that way?



What I need is that the event launch on a click inside the checkbox not on the expansion of the branch!

And that the expansions of the branch do nothing to the checking of the branch underneath the one I selected.

11/05/2008 11:38
 
dan said:

Hi inter-log,

This seems to be a bug when adding the node programatically, as it seems to work when declaring nodes in XAML. I will get this added as a bug to be fixed in the next version. Thanks!

10/30/2008 04:58
 
dan said:

Hi karlssonkatrin,

Good question. Looking at it it seems you are right, by disabling the parent all children become disabled. I will check this out further and let you guys know but I think this may not be changeable at the moment. Thanks!

10/30/2008 04:56
 
inter-log said:

Hi Dan,
I would like to pre-check some tree nodes when the tree is displayed. In the Tree_Populate function, I first create the tree node and add it to it's parent node, then I call node.Checked = true. But it just not work. The node is not checked when displayed. Do you know how to do it? Thanks!

10/29/2008 09:11
 
karlssonkatrin said:

Hi,
Nice control!

Is it possible to have childnodes enabled/clickable when the parent node aren't?

I have some parentnodes added in the xaml code. These have the property IsEnabled=false.
I add childnodes to these nodes in the codebehind file. I set IsEnabled to true and it's still not possible to click on these childnodes, if I also change the parentnodes settings it works but I don't want to be able to click on these.
I'm able to change other properties on the childnodes for example foreground color.

10/29/2008 07:22
 
dan said:

Hi danc,

Thanks for letting us know. This is a known bug which will be fixed and a new version released soon!

10/24/2008 05:27
 
danc said:

Very nice control! Thank you for making it available!

I am also trying it out and am getting a null for Get. For example:

tree.Nodes.Add(new Node("1","First node",false));
Node node = tree.Get("1");     // returns null

10/22/2008 08:16
 
dan said:

Hi Brad,

Thanks for the bug reports, these will be looked at in the next few days and if necessary a fix will be issued shortly afterwards.

With regards to your SelectionChanged query, the Source property contains the currently selected node and Target is the node that will be selected if you return args.Cancel = false, let me know if this is not what you are seeing.

Thanks!

10/21/2008 12:39
 
bwhalversen said:

Dan:

It would be very useful in a SelectionChanged event to be able to determine from the TreeEventArgs passed what node will be selected if the selection is not cancelled. Maybe it is possible to determine this reliably from the drop Source and Target properties but it is not clear how.

Any ideas?

10/20/2008 04:40
 
bwhalversen said:

Dan:

Probably related to my last post: the up/down arrow keys do not work for moving through multiple nodes at the root level.

10/20/2008 04:37
 
bwhalversen said:

Dan:

Thanks for the fix for showing lines correctly for multiple root nodes.

In the latest build I am always getting "null" returned from calls to:

tree.Get(string Id)

when there are multiple root level nodes and I pass an ID for a root level node. If you can replicate it looks like a bug.

10/20/2008 03:41
 
dan said:

Hi bioagcsr,

Thanks for the post. The images are included with the treeview examples on this page. You must be logged in and at the top of the page is "Download TreeView XAML Example" try this link. There is also a full treeview demo here.

10/16/2008 02:57
 
bioagcsr said:

I greatly appreciate this control-
If I can get it working, it will serve a great contribution to the content management system I'm developing.
There are a few problems though, but I think they all link back to my not using images.
When I downloaded the v.5.0 zip file of the control, there weren't images inside as mentioned-

Should I be looking elsewhere for this?

10/15/2008 07:10
 
mememe said:

Hi and thanks for your cool controls

As described earlier, I've also problems allowing the events triggerring
It seems like NodeExpanded will only fire if there are actually children nodes under the expanded node which in my case is not true as I use the events to load nodes on demand...

Thanks in advance

10/10/2008 06:33
 
dan said:

Hi Brad,

Please can you email them to support@vectorlight.net including the screenshots showing the bug and also how you think they should look. Thanks!

10/06/2008 02:26
 
bwhalversen said:

Dan:

How do I send you file attachments - the screen shots I promised regarding enabling lines with multiple root level nodes?

Brad

10/06/2008 01:01
 
dan said:

Hi Martin,

Consider it done. This will be implemented in the next version. Thanks!

10/05/2008 03:40
 
m.wawrusch said:

Thanks dan.

Regarding the SelectionChanged event I think it is very important to include both the old and the new node as an event argument. Also it should react to changes made by using the mouse keys.

Martin

10/03/2008 08:28
 
dan said:

Hi Brad,

Thanks for reporting this, and it does indeed look to be a bug. You can indeed send screenshots, I have added it to the list of bugs and will certainly be resolved in the next version. Thanks for reporting this!

10/03/2008 02:03
 
dan said:

Hi m.wawrusch,

There is only a NodeClick event at the moment, you could attach an event handler to this and check the value of testTree.Selected to see if it is different to the previous clicked node. What you are suggesting is a good idea and I will get it added to the list of improvements for the next version. Thanks!

10/03/2008 02:03
 
bwhalversen said:

We are looking at licensing the your TreeView control for a SL project but have run into a little snag, perhaps a bug. It appears that the EnableLines property when set to true only works properly if the tree has a single root node. If the tree has multiple nodes at the top level, that is in treeView.Nodes, the lines connecting the nodes are drawn incorrectly at that top level. I can send a screen shot showing the problem if you would like. I can also send you a screen shot suggestion on how they should or could look.

If this is by design or a bug please let me know. If a bug, will it be scheduled to be fixed?

Brad

10/03/2008 08:49
 
m.wawrusch said:

Hi,

is there some kind of SelectionChanged event or a workaround? I am using version 5.0

Thx.

10/01/2008 05:57
 
dan said:

Hi Apotta,

The scrolling with the cursor keys should work fine, I will investigate this and if it proves to be an issue I will add it to the list for fixing. I will do the same for the issue you have with the horizontal scroll bar. Thanks!

Hi asufka/Rob,

Thanks for your post. Yes, the checkbox is not stylable at the moment due to it being created programatically, we will look to do something about this soon. Thanks!

09/27/2008 10:29
 
rs said:

Is there anyway to change the color of the checkbox. I would like to vary the color of the checkbox to correspond with the color of the information that is displayed on the screen.

Thanks....

09/26/2008 09:10
 
asufka said:

Is there a way to customize the checkbox? I see how to use styles and control templates to skin the rest of the UI, but not for the checkboxes.

09/23/2008 02:25
 
apotta said:

Hi Dan

Thanks for your reply..i could figure out the issue that i mentioned in my last post...
Could you please help me in the following:

1. The Auto scrolling doesn't seem to work..when i navigate through the tree using keyboard the tree doesn't scroll automatically..i had to scroll with mouse...

2. I am expaning some nodes through code...in that case the horizontal scroll doesn't appear..i had manually click the node for the horizontal scroll bar to appear...

Could you please address these issues in the next version atleast???

Thanks

09/18/2008 03:03
 
dan said:

Hi apotta,

I will put an example together for you in the next few days and email you a copy. Thanks!

09/17/2008 11:06
 
dan said:

Hi John,

Thanks for your post, I have passed your example and query onto one of our developers to look at. I'll let you know any feedback. Thanks!

09/17/2008 11:04
 
dan said:

Hi,

At the moment the Node is limited to an Icon and single TextBlock, moving over to a ContentControl is something we are looking at and will keep you posted!

09/17/2008 11:03
 
Bleh blah said:

I'm assuming this isn't the case, but I'll ask anyhow in case I've ignored something:

Is there a way of using more customized content in the tree view, or is it limited to displaying a single text string only (through the Title attribute)?

I was thinking more in the line of a "Content"-ish attribute, like that of the standard SL Button control. (So that I could add text, images and whatnot to a node)

09/17/2008 02:37
 
apotta said:

Hi Vijesh

You can try officeTree.Find() to get a node. It returns a collection of nodes...

09/16/2008 03:03
 
vijeshmv said:

Hi Dan,

I am using a tree which have lots of parent nodes(let us call it as Project nodes) and each parent nodes have multiple children nodes(let us call it as File nodes).

I want to check if there is a File name exist or not before i save a new File in a selected Project node. I always store selected Project node name in a variable called _selectedProjectName.

I found a tree.Get methode to get the node. but its not working. It always returns null. I tried the following commands in my immediate window. results also included.

treeProjects.Nodes.Count
Result:     1

treeProjects.Nodes[0].ID
Result:     "Bank"

treeProjects.Get(treeProjects.Nodes[0].ID).ID
Result:     '((Liquid.LiquidControl)(treeProjects.Get(treeProjects.Nodes[0].ID)))' is null


Thanks & regards
Vijesh

09/15/2008 11:50
 
joriente said:

Hi, I am having an issue with setting the height and width to auto my tree is in a grid. if the width and height are set to auto the control does not appear. the control is filled on a button click... not in the load event. if the height and width are set to something, the control works ok Below is my xaml

Thanks for your help

<UserControl x:Class="SilverlightPlaylist.Page"
                 xmlns:liquid="clr-namespace:Liquid;assembly=Liquid"
     xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:data="clr-namespace:System.ComponentModel;assembly=System.Windows.Controls.Data"
     Width="Auto" Height="Auto">
    
     <Grid x:Name="LayoutRoot" Background="White" ShowGridLines="False">
         <Grid.RowDefinitions>
                <RowDefinition Height="50" x:Name="HeaderRow"></RowDefinition>
                <RowDefinition Height="*" x:Name="ContentRow"></RowDefinition>
                <RowDefinition Height="20" x:Name="FooterRow"></RowDefinition>
         </Grid.RowDefinitions>
         <Grid.ColumnDefinitions>
                <ColumnDefinition Width="*"></ColumnDefinition>
         </Grid.ColumnDefinitions>

         <!--Header Row-->
         <TextBlock x:Name="txtHeader" Grid.Row="0" FontSize="20" Margin="5,5" Foreground="Blue" Text="Playlist Creator"></TextBlock>

         <!--Status Box-->
         <TextBlock x:Name="txtStatus" Grid.Row="2" FontSize="10" Margin="5,0" Foreground="Red"></TextBlock>

         <!--Content-->
         <Grid x:Name="ContentGrid" Grid.Row="1" Margin="5" ShowGridLines="True">
                <Grid.RowDefinitions>
                     <RowDefinition Height=".7*"></RowDefinition>
                     <RowDefinition Height=".3*"></RowDefinition>
                </Grid.RowDefinitions>

                <Grid.ColumnDefinitions>
                     <ColumnDefinition Width="Auto"></ColumnDefinition>
                     <ColumnDefinition Width="Auto"></ColumnDefinition>
                </Grid.ColumnDefinitions>

                <ListBox x:Name="lstTrackPool" Grid.Row="0" Grid.Column="0"
                     Loaded="lstTrackPool_Loaded" Width="Auto" Height="Auto">
                     <ListBox.ItemTemplate>
                         <DataTemplate>
                                <StackPanel Orientation="Vertical">
                                     <CheckBox x:Name="chkTrackPool" IsChecked="{Binding IsChecked, ,Mode=TwoWay}" Content="{Binding Name}" Margin="2" Tag="{Binding Id}" ClickMode="Press"></CheckBox>
                                </StackPanel>
                         </DataTemplate>
                     </ListBox.ItemTemplate>
                </ListBox>

                <Grid x:Name="PlaylistOptions" Grid.Row="1" Grid.Column="0" Margin=".5">
                     <Grid.RowDefinitions>
                         <RowDefinition Height="22"></RowDefinition>
                         <RowDefinition Height="22"></RowDefinition>
                         <RowDefinition Height="22"></RowDefinition>
                     </Grid.RowDefinitions>
                     <Grid.ColumnDefinitions>
                         <ColumnDefinition Width=".7*"></ColumnDefinition>
                         <ColumnDefinition Width=".3*"></ColumnDefinition>
                     </Grid.ColumnDefinitions>
                     <TextBlock Grid.Row="0" Grid.Column="0" Text="Select the # of playlist" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBlock>
                     <TextBox x:Name="txtPlaylist" Grid.Row="0" Grid.Column="1" FontSize="12" MaxLength="3" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top" Text="1"></TextBox>
                     <TextBlock Grid.Row="1" Grid.Column="0" Text="# of songs/playlist" FontSize="12" HorizontalAlignment="Left" VerticalAlignment="Top"></TextBlock>
                     <TextBox x:Name="txtSongs" Grid.Row="1" Grid.Column="1" FontSize="12" MaxLength="4" Height="20" HorizontalAlignment="Left" VerticalAlignment="Top" Text="10"></TextBox>
                     <Button x:Name="btnCreateList" Click="btnCreateList_Click" Grid.Column="0" Grid.Row="2" Grid.ColumnSpan="2" Margin="0" Width="25" FontSize="10" Content="Go"></Button>
                </Grid>
            
                <liquid:Tree x:Name="treePlaylist"
                     Grid.Row="0"
                     Grid.Column="1"
                     Grid.RowSpan="2"
                     HorizontalAlignment="Left"
                     VerticalAlignment="Top" Width="Auto" MinWidth="500"
                     MinHeight="100"
                                
                     Height="Auto"
                     EnableDragAndDrop="True"
                     Drop="treePlaylist_Drop"
                     KeyDown="treePlaylist_KeyDown"
                     Populate="treePlaylist_Populate"></liquid:Tree>
         </Grid>
     </Grid>

</UserControl>

09/08/2008 05:27
 
apotta said:

Hi
Thanks for your reply...I tried to use your example to replace the plus icon(to expand a node)...but no luck...
could you please gimme a small example which allows me to replace the plus icon...
It would have been good if it can be configurable.... :)
Thanks

09/07/2008 07:43
 
dan said:

Hi Seattle_mike,

At the moment the amount of indent is not configurable but is something we will look at implementing in the next version. Thanks for your suggestion!

09/07/2008 11:44
 
dan said:

Hi Nima,

Thanks for reporting this. It is a bug and we will address it with a fix in the next verison. Thanks for letting us know!

09/07/2008 11:43
 
dan said:

Hi Jamie,

The current version of the controls library is 4.9.1 and has been fully tested and is designed for Silverlight 2 BETA 2. Can you verify the version number of the Liquid.dll you have?

09/07/2008 11:42
 
seattle_mike said:

Is there any way to control the amount of indent of the nodes? I need less indent so I can display my tree in grid without horizontal scrollbars.

Thanks.

09/04/2008 11:44
 
rs said:

Answered my own question: (post Sept 2)

NodeCheckChanged

09/03/2008 07:00
 
Nima said:

Hello there, I've been using both version 4.9 and 4.9.1 and I think I've come across a bug with Horizontal Scroll Bar.

If I was to create a new Node with a name longer than the width of the tree control and set the HorizontalScrollBarVisibility property either to Auto or Visible, the scroll bar doesn't work until I've expanded a node anywhere on the tree. I programmatically populate the tree.

This happens on Tree.BuilRoot() as well. So Populate event and Nodes.Add

Please let me know if this is not a bug and I'm missing something...

Thanks...

09/02/2008 03:09
 
jpullar said:

Release 4.9.2, which I believe came out today Treeview control appears to not be supported in Beta 2, with the onAppyTemplate method error occurring. I saw this has been raised for the DateList control. Any word on when this will be fixed for treeview?

Cheers!

09/02/2008 09:43
 
rs said:

Using TreeView 4.9.

QUESTION:
When I click on the node name the program enters the Tree_NodeClick function.

However, when I click on the checkbox, the program does not enter Tree_NodeClick. What function is called when click on checkbox.

In the xaml file the following is set: NodeClick="Tree_NodeClick"

Thanks......

09/02/2008 09:11
 
dan said:

HI apotta,

The node expand is actually XAML elements, there is an example here which shows you how to do Vista style nodes, let us know if you need further examples!

08/30/2008 04:36
 
apotta said:

Hi

The control is really cool...is there any way to change the plus icon used to expand a node...

Thanks

08/29/2008 12:13
 
dan said:

Hi Zeinab,

The problem may still be todo with the controls library, I'm running a few more tests to try to work out the cause and whether its the controls library or not. Thanks!

08/28/2008 11:47
 
dan said:

Hi arasium,

At the moment the Horizontal/Vertical Alignment properties do not work, you can however set Width="Auto" or Height="Auto" if you want the TreeView Control expand to the size of it's parent control. Thanks!

08/28/2008 11:44
 
arasium said:

Hi,

I can notice a little problem in your componant. The property Horizontal/VerticalAlignement at the value "stretch" seems to not working. We can use an event on the parent to resize the tree when the parent is resizing but it shuuld be so much easy with the stretch...

08/28/2008 04:35
 
Zeinab said:

Hi dan ,
I tried your suggestion and it seems you're right.I put a breakpoint and the project runs whithout forcing visual studio to close but still causing the error when you build the project.

But as i think the problem occurs when loading the designer of Page.xaml. If you open the page then build the project the error occur after this expression "Loading..ESC to cancel" and if you close this page everything seems to work well

08/25/2008 11:39
 
dan said:

Hi byter10,

Thanks for your post. The issue with the programatic use of node.Expand() has been addressed and a fix will come in the next version, unfortunately there is no work around in the current version. Thanks for your patience during this busy time!

08/22/2008 05:10
 
dan said:

Hi t_h_price,

Yes, this is a known bug and will be resolved in the next version!

08/22/2008 05:08
 
dan said:

Hi niravlvyas,

Thanks for reporting this, we will get the demo updated and a working example posted to the site as soon as possible!

08/22/2008 05:07
 
dan said:

Hi Nathan,

I assume this is when populating using a web service or some other lengthly process? If that is the case then in your Populate() event handler you can set the cursor using:

this.Cursor = Cursors.Wait;

And when your web service completes and you have populated the nodes you can use:

this.Cursor = Cursors.Arrow;

Let us know if this isn't how you're populating the nodes!

08/22/2008 05:06
 
dan said:

Hi Zeinab,

I have seen this problem recently and have tried to replicate it but not always consistently, it does seem to be something to do with Visual Studio. For example, put a breakpoint on the following line in your C#:

InitializeComponent();

And step through, the project seems to always work when stepping through it at least once. If you give that a try and let us know, and hopefully we can narrow the problem down.

08/22/2008 05:02
 
byter10 said:

Hi Dan,

I'm also having issues expanding programatically added nodes. And my actual situation, is that I'm trying to allow a user to navigate the tree by using a Next/Prev set of buttons. All nodes in my tree are numbered like so:

1
     2
     3
         4
         5
6
7

and so on. I can select the right node by doing:

this.groupTree.Selected = foundNode

but .. the problem is that if the node is under other nodes, the parent nodes will not expand. Nor can I do it manually with any of the Expanded = true, Expand(), ExpandAll(), ExpandOut() methods or properties.

Any suggestions?

08/21/2008 09:43
 
t_h_price said:

When Expanded="True" the node expands but the nodes below are not visible

Background color is having difficulty

08/20/2008 04:39
 
niravlvyas said:

Hi Dan
Nice controls.You are just fabulous.I downloded both of them.TreeViewXaml is working nicely.But when i build TreeView without changing it,I am getting Errors
"Error 1 The name 'InitializeComponent' does not exist in the current context" -page.xaml.cs
"Error 2 The name 'testTree' does not exist in the current context" -page.xaml.cs
"Error 1 The name 'InitializeComponent' does not exist in the current context" -app.xaml.cs

08/20/2008 03:11
 
nathan said:

Great toolset.

How can I display an ourglass whilst populate-ing?

08/14/2008 07:31
 
Zeinab said:

In fact all events in xaml code have their corresponding events in c# code not only populate event

08/14/2008 05:18
 
Zeinab said:

Hi Dan,

Below is the XAML code of the page :

<UserControl x:Class="TreeView.Page"
     xmlns="http://schemas.microsoft.com/client/2007"
     xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
     xmlns:liquid="clr-namespace:Liquid;assembly=Liquid"
     Width="400" Height="300">
     <Grid x:Name="LayoutRoot" Background="White" VerticalAlignment="Top" HorizontalAlignment="Left">
         <liquid:Tree x:Name="testTree" Canvas.Top="295" Canvas.Left="200" EnableCheckboxes="true" EnableDragAndDrop="false" Width="200" Height="151" Margin="4" Populate="Tree_Populate" Drop="Tree_Drop" NodeClick="Tree_NodeClick" />
     </Grid>
</UserControl>


I ensured that the populate event has corresponding c# event handler . I tried the demo projects in this article without any changes but the same problem occur.

What do u think is this a visual studio bug?

08/14/2008 05:16
 
dan said:

Hi Zeinab/lycanthrop,

Can you post your XAML code to this page and we'll take a look. Ensure you have no event handlers declared in your XAML that do not have a corresponding C# event handler otherwise you will get compilation errors. Thanks!

08/14/2008 04:54
 
lycanthrop said:

Has anyone experienced random crashing of Visual Studio 2008 while using TreeView ?
It is a random event and cannot see any pattern yet.
And has only started since using TreeView.

Am using
Visual Studio 2008 with SP1 Beta 1 with .NET 3.5 SP1
Silverlight Version: 2.0.30523.8

p.s. Besides this, these tools where what was missing in the microsoft control set.

08/13/2008 03:26
 
Zeinab said:

Hi dan ,

Yes this happens when viewing the xaml page.

I tried to close this page and i build and run the project successfully many times without any problem.

08/12/2008 11:18
 
dan said:

Hi Zeinab,

Does this happen when you are using the XAML preview page?

08/12/2008 10:45
 
Zeinab said:

Hi Dan,

Building a basic silverlight project doesn't cause that error , and about running the example project i tried that and i tried to run examples for others Liquid controls but i still have the same problem.

This doesn't happen in all builds but approximately 85% of times that i build or run my project i got the same error.


Thanks for ur reply.

08/12/2008 05:50
 
dan said:

Hi Zeinab,

Have you attempted to download and run the example project rather than typing it in? Have you managed to build a basic Silverlight project and run that without the Liquid controls dll?

08/08/2008 11:36
 
Zeinab said:

Hi

I am trying to use your tree View control but when i build my project i have an error in visual studio informing me that :
         "Microsoft Visual Studio has encountered a problem and needs to close." I am using Liquid.dll version 4.9 and i just tried the xaml code in this article. i don't know what causes this error .

I have the same error when reying to build your example.
Any Help please.

Thanks.

08/07/2008 05:34
 
dan said:

Hi Jason,

Thanks for the bug report. We have managed to replicate the problem you have been having with the Expand() method for the Node control and you are right, the introduction of the expand animation has introduced this bug to the Expand() method when called programatically.

The error only occurs when trying to expand a node that has been added programitally and does not affect nodes generated in XAML.

We'll get this addressed shortly. Thanks again!

08/05/2008 05:17
 
Jason Paape said:

Hi,

I have upgraded to the 4.9 version of the Tree View control. I now have a problem when I try to programmatically add tree nodes and expand them using the Node.Expand() method. This is the exception I get.

System.Reflection.TargetInvocationException: Exception has been thrown by the target of an invocation. ---> System.NullReferenceException: Object reference not set to an instance of an object.
    at Liquid.Node.SetChildVisibility(Boolean visible)
    at Liquid.Node.Expand()

You should be able to repro this by programmatically creating a parent node and then add a child node to it and then call Expand() on the parent node.

I suspect the problem might be related to how there is now an animated expanding storyboard that runs when a node is expanded. I'm pretty sure this worked in the 4.8 version.

Here is repro case... I modified the "TreeView" sample from this site and in the Tree_Populate method I programmatically add a node under the "My Music" node and then call Expand() for that node:

...
case "0":
try
{
Node n = new Node("1", "My Music", true, "TreeView;component/images/folder.png", "TreeView;component/images/folderOpen.png");
nodes.Add(n);
n.Expand();
}
catch (Exception ex)
{
string msg = ex.Message;
}
...

Is this a bug in the TreeView control?

Jason

08/04/2008 12:20
 
dan said:

Hi Phil,

Try replacing:

nodes.Add(new Node("0", "Issue Tracker", true, "IssueTracker;component/images/world.png"));

with:

nodes.Add(new Node("0", "Issue Tracker", true, "images/world.png"));

In Silverlight 2 BETA 2 you no longer have toi specify the assembly name and 'component', I've updated the examples above too. Let us know if your still having problems!

08/02/2008 09:25
 
philbush said:

Oops, sorry about the spaces

07/30/2008 05:59
 
philbush said:

Hi

I am trying to populate a Tree, however I get the JS error 'Sys.InvalidOperationException: ImageError #4001 in control 'Xaml1': AG_E_NETWORK_ERROR'

My image has been added as a Resource, and I am at my wits end trying to fix this.

Here is an example of my code:


private void Tree_Populate(object sender, TreeEventArgs e)
         {
                ObservableCollection<Node> nodes = (sender is Tree ? ((Tree)sender).Nodes : ((Node)sender).Nodes);

                if (sender is Tree)
                {
                     nodes.Add(new Node("0", "Issue Tracker", true, "IssueTracker;component/images/world.png"));
                }
                else
                {
                     // TODO: Add code here
                }
         }
Am I missing something????

Thanks

Phil

07/30/2008 05:58
 
dan said:

Hello Jason,

Glad you like the controls, and thanks for the bug reports we'll get these resolved in the next version. Thanks!

07/16/2008 10:17
 
Jason Paape said:

Hello, I am using your Tree View control. Great control! Very very nice work.

Just want to report a couple bugs I found with the 4.8 version in case you didn't know of these:

When using the Node ctor, such as this:
Node node = new Node(id, title, hasChildren, icon, iconExpanded);
I noticed that the iconExpanded is not being set. If I specify the path to two different icons for icon and iconExpanded, the path to icon is set for both of those two. If I set the node.IconExpanded property directly, that works fine.

When attaching a set of created Nodes to a parent node in code, such as this:
parentNode.Nodes = MyMethodThatCreatesTreeNodes();
It seems that the ParentNode for each of the new child nodes is not being set properly. It is null for all the children nodes. So, I wrote code after this like this:
foreach (Node node in parentNode.Nodes)
{
if (node.ParentNode != parentNode)
node.ParentNode = parentNode;
}
To properly set the ParentNode of each child node.

07/15/2008 04:19
 
dan said:

Hello,

Yes this is a bug in the current version and is being fixed in the next release, thanks for reporting this and for your patience during this busy period!

07/09/2008 10:17
 
sarahosgood said:

Hello,

Treeview does not resize dynamically - unless I'm missing something obvious :)

The treeview is contained within an autosizing grid. On the treeview control I have height and width = auto, alignment = stretch and margins = 10. The treeview control starts off very small. It adjusts its' size when nodes are expanded, allowing all nodes to be viewed, but this continues even when it pushes the control off the edge of the screen.

It's very frustrating becuase this inability to resize dynamically makes my application look amateurish. Please help!!

07/08/2008 04:13
 
rob_houweling said:

Hi,

When I place the treeview in a grid with multiple rows and columns and I set the width and height to auto it does not stretch to the available width and height. I also tried the HorizontalAlignment="Stretch" VerticalAlignment="Stretch" but this makes no difference.
Can you help me figure out what I'm doing wrong?

Kind regards,

Rob Houweling

07/04/2008 02:47
 
dan said:

Hello,

There is no way at the moment to enable connector lines, this is on the list for future enhancements, thanks for the post!

07/03/2008 11:02
 
vgsbs said:

Hello - Is there a way to enable the TreeView connector lines? Or will this be enabled in the future? Thanks!

07/03/2008 07:35
 
hinsano said:

Hello Dan!
I'm working with your treeview for 3 months, and seriously it's a very good work!
I just have a question, I need to populate a node by the code, not just by clicking on the cross of the node...
How can I do?
I need something like myNode.Populate()..... That's already exists? (I don't think) That will be available soon?

Sorry for my english

Thanks in advance,
Adrien

06/30/2008 05:29
 
dan said:

Hello Phil,

We have identified a problem with the tree re-sizing correctly when the Width/Height properties are set at runtime and have fixed them in the next version which will be available in the coming week. Thanks for identifying this!

06/28/2008 12:15
 
PhilHiggins said:

Dan,

Thank you for your response. I've done some further testing and am definitely experiencing problems with run-time re-sizing. If you can run some tests of your own, that would be great.

Here's a summary of my tests so far:

I've got a treeview that starts off with two nodes where HasChildren = true. It is on a grid with height and width set to Auto and a uniform margin on all sides. The Silverlight object re-sizes with the browser and so does the Page.Xaml user control and LayoutRoot grid element.

The treeview starts off very small. When a node is expanded, I use the NodeExpanded event to add two child nodes to it, also with HasChildren = true. All expansions then draw the treeview at the size required for showing the nodes and this continues even if it pushes the treeview control off the edge of the Silverlight object canvas.


If you'd like my test program, please feel free to e-mail me with an address where I can send it.

Thanks.

06/26/2008 02:25
 
dan said:

Hello,

The re-sizing should work fine, we'll run some tests and get back to you on this one. Thanks for letting us know!

06/25/2008 12:12
 
PhilHiggins said:

Hi,

I do not seem to be able to dynamically re-size the TreeView at run time. Is this something you know about?

I've tried making the control re-size by a few methods. I've had it on a Grid and used stretch alignment and margins. I've also tried to manually re-size the control on both a grid and a canvas by using SetValue to set the HeightProperty and WidthProperty values when the SizeChanged event triggers. It seems to initialise with the size ok, but it then remembers it and overrides any attempt to change it.

Thanks.

06/24/2008 03:28
 
Seznid said:

Hi again,

silly mistake on the last post, so feel free to ignore it!
While the new version was running on the silverlight control, unfortunately the xap file still insisted on using the old version.

06/22/2008 07:25
 
Seznid said:

Hi Dan,

Brilliant controls: I'm currently using version 4.7 having upgraded a program I'v been playing around with since beta 1 - When attempting to enable checkboxes on my treeview I get the following error (using firebug)

System.ArgumentException: DependencyProperty of type System.Double cannot be set on an object of type System.Int32 at System.Windows.DependencyObject.SetObjectValueToCore(IntPtr oPtr, DependencyProperty dp, Object value) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value, Boolean isSetByStyle, Boolean isSetByBuiltInStyle) at System.Windows.DependencyObject.SetValueInternal(DependencyProperty dp, Object value) at System.Windows.DependencyObject.SetValue(DependencyProperty dp, Object value) at Liquid.Node.UpdateVisualState() at Liquid.Node.UpdateCheckbox() at Liquid.Node.set_EnableCheckboxes(Boolean value) at Liquid.Tree.set_EnableCheckboxes(Boolean value)

Is there currently a workaround for this?
My code at the moment is simply ContactListTree.EnableCheckboxes = true;

06/22/2008 06:55
 
dan said:

Hello,

Thanks for the bug report, the switch-over to Silverlight 2 BETA 2 has broken a few things. This will be resolved soon.

06/11/2008 05:04
 
kkk said:

Hi ,
There is bug in treeview ver.4.6
EnableCheckbox option does not have any change.

Please Check this option .

Thanks

06/11/2008 01:44
 
dan said:

mmilella:

Yes, there is a bug in the treeview control, it is under investigation/fixing at this moment and we hope to get this resolved in the next release.

kevinli:

Changing the font in the TreeView is in the next version.

Thanks for your patience!

06/06/2008 11:17
 
mmilella said:

I cannot get node events to fire... I have tried a number of them but have had no luck. The event I need it NodeExpanded. Is there something I am missing?

BTW Awesome Controls!!

06/06/2008 08:58
 
kevinli said:

Hi,

Can the TreeView font be changed?


Thanks,

Kevin

06/06/2008 02:16
 
dan said:

Hi,

Nodes are not editable at the moment on the Treeview itself, the text can only be changed programatically by setting the Title property. This is a good suggestion and has been added to the list of improvements for the next version!

06/05/2008 10:39
 
rparsons said:

Is there a way to rename a node as in WinForms by pressing F2 or any other key? I have looked in the demo and didn't see a way to accomplish this.

Thanks

06/05/2008 09:08
 
gambles said:

Hi

When I add nodes programmatically and set EnableCheckboxes = true, they do not show up. However if I set the property through the Tree_node click event they show up fine.

Also, if I set the tree property EnableCheckboxes = true, then I can selectively disable checkboxes for child nodes

I am using Liquid Controls 4.4.

05/13/2008 05:57
 
gambles said:

Hi

When I add nodes programmatically and set EnableCheckboxes = true, they do not show up. However if I set the property through the Tree_node click event they show up fine.

Also, if I set the tree property EnableCheckboxes = true, then I can selectively disable checkboxes for child nodes

I am using Liquid Controls 4.4.

05/13/2008 05:52
 
Paul Fretter said:

Hi Dan,

Thanks for the speedy reply.

Yes I realised after I posted the Load was a standard event, sorry.

I will still need to reload the data for other reasons. Is there anywhere else I should be putting the ExpandAll call? I tried directly after the BuildRoot method call but whilst that does force the control to recursivly load all the sub nodes, it leaves the root visually collapsed. I tried a direct call to tree.Nodes[0].Expand() but that caused the rest of the tree to dissapear. I figured that was maybe because the tree was being populated asyncronously.

As for the little bug; yes I will try to break it down and send you the minimum code necessary to reproduce.

Thanks
P

05/13/2008 06:24
 
dan said:

Hello Paul,

Thanks for your comments. The Loaded event is a standard Silverlight control event and isn't used by the Tree control to indicate all data is loaded. We are looking at implement such an event at the moment.

The issue you are having with the duplicate nodes when dragging and dropping, I was unable to replicate this using the treeview demo on this site, do you have any sample code demonstrating the problem? If so, email it to us: support@vectorlight.net!

05/13/2008 05:36
 
Paul Fretter said:

Hi there,

I am dynamically building the tree from code. I would like to be able to epand all nodes the moment the data has finished loading.

To do this I added a Loaded event handler and put a call to the tree.ExpandAll() method in there.

It does not appear that the Loaded event gets fired.

P.S.
One reason I am doing this revolves around the fact I want to reload the data each time I move a node because the control currently seems to have a small bug. When I drag a node from parent a to parent b, then drag the same node back to parent a - I get two identical nodes under parent a until I drag one back to parent b.

Thanks.
(Nice controls though :)

05/13/2008 04:20
 
sportsmenltd said:

I now have a similar issue to one down further in this thread. I have a tree control within a split grid control. When I resize the split grid, the tree control losses it's scroll bars. Some nodes are hidden with no way to access them (without being able to scroll). However, when I click on a folder node to expand/contract it, the scrollbars come back and all works fine until I resize the workspace again via the split grid. Any work around or fix for this?

05/06/2008 10:53
 
dan said:

Hello,

The reason the screen whites out is because the image URL's in your Node declarations are incorrect or the images are missing. In the first example (The XAML one) there is the following attribute...

Icon="TreeViewXAML;component/images/folder.png"

The bit that says "TreeViewXAML" is the name of your project dll and in your project root folder the following file must exist and be included in your project as a resource...

"images/folder.png"

If the file is missing then .NET throws an exception and you get the white screen.

That's why the downloaded zip example works and your manual effort does not. Please let us know if you are still having problems with this!

05/06/2008 07:17
 
sportsmenltd said:

I should also add to the comment below that when I download the sample project (TreeviewXAML) it works fine. When I follow the step by step instructions on this page to create a new Silverlight project and then insert this same tree, it doesn't work for me. I see the tree for a split second in the browser, then it dissappears. Any thoughts? Thanks.

05/06/2008 07:06
 
sportsmenltd said:

I followed the instructions for the tree as listed on this page precisely. However, when the test page renders, it shows the tree control for a split second and then the screen whites out. There must be an exception occuring somewhere. I just downloaded the newest version. I'm building it with VS2008. Any ideas? I have all the xaml lines and reference to Liquid.dll set up in the project. I'd like to use this if I can get it to work.

Thanks.

05/06/2008 07:02
 
sportsmenltd said:

I followed the instructions for the tree as listed on this page precisely. However, when the test page renders, it shows the tree control for a split second and then the screen whites out. There must be an exception occuring somewhere. I just downloaded the newest version. I'm building it with VS2008. Any ideas? I have all the xaml lines and reference to Liquid.dll set up in the project. I'd like to use this if I can get it to work.

Thanks.

05/06/2008 06:39
 
dan said:

Hello,

Thanks for the report, this is a bug and we'll be looking at this soon!

05/06/2008 12:03
 
Mikhail said:

Hi Dan, it looks like I hit another problem. If I set checked property of the node programmatically (myNode.Checked = false), NodeCheckChanged event does not fire, though from UI everything looks OK. Could you check this?
Regards, Mikhail

05/01/2008 08:27
 
dan said:

Hello Mikhail,

The node that fired the checked event is available as the sender parameter. In the latest version 4.4 the node that fired the event is now in the Source field and also the ID is populated correctly. Thanks for the bug report!

04/29/2008 03:46
 
Mikhail said:

Hi Dan,
it looks like I have another problem with the tree. If I enable checkboxes for the tree which I'm creating dynamically and try to handle NodeCheckChanged event fires OK, but partically all properties of the TreeEventArgs event are null (like source, target, ID). Which is most important that even I cast sender to Node, then its Checked property always shows false. Is this a bug?
Regards, Mikhail

04/26/2008 06:54
 
dan said:

Hello guys,

Firstly:

We can certainly add an event that fires when the Expand() / ExpandAll() method has completed, we've added this to the features list for the next version due out soon. Thanks for your input!

Secondly:

The source code for the above example on this page can be downloaded by clicking on the Red download image when you have logged in. The source code from the main demo at Dynamic TreeView which is what I think you want (which features the new version of the controls library) will be available soon (28/4/2008 or earlier)!

04/21/2008 03:35
 
hinsano said:

Good job for the new Tree view!
Just a question, that's possible to get the source code of the new tree view example?
(sorry for my english...)

Thx in advance.

Adrien

04/21/2008 03:20
 
j.grijmans said:

Hi,
This is a perfect control. Good work guy’s!!
I wonder if there is an event planned that fires when the expandAll of the expand function is called. Or is there another way to determine the moment the tree or node is fully expanded?

04/21/2008 01:56
 
j.grijmans said:

Hi,
This is a perfect control. Good work guy’s!!
I wonder if there is an event planned that fires when the expandAll of the expand function is called. Or is there another way to determine the moment the tree or node is fully expanded?

04/21/2008 01:46
 
dan said:

Hi Mikhail,

Were testing the issue you have reported regarding the use of the tree within the StackPanel and will determine if there is a problem here. We are aware of an issue with the ScrollViewer control when collapsing nodes and the scrollbar going off the bottom of the control which is being looked at.

We are making the properties of the ScrollViewer available to the developer in the next version which will allow you to control scrolling.

Thanks for your input!

04/16/2008 11:25
 
Mikhail said:

Hi Dan,
I'm using version 4.3. I've populated the treeview dymamically and added it to the stack panel. The problem that I'm not able to use verstical scroll thought a number of treenodes is out of the scope of the treeview. Also I did not find any possibility to control scrolling through properties (I belive somthing like that was in the previous version). Can you comment on that?
Regards, Mikhail

04/15/2008 08:52
 
dan said:

Hello All,

Version 4.3 is available from the downloads page and fixes the various issues with population using asynchronous methods.

04/14/2008 08:02
 
dan said:

Hi,

The TreeView is in a state of transition:

1. Currently it uses a custom scrollable area which cannot be easily formatted. We are changing this to a standard Microsoft ScrollViewer control which will be included in the next version.
2. The SetSkin() method was for Silverlight 1.1 before the Templating method introduced in Silverlight 2 BETA, we have considered bringing it back as the new method of applying styles is fine in the XAML editor but you cannot dynamically apply styles at runtime. The next release of the TreeView will be highly customizable.

04/11/2008 06:47
 
bdragon said:

great control, but there are 2 questions i have(version 4.2)
1 is it possible to change treeview's color(text,scrollbar,background)
2 does the control still have SetSkin method

04/11/2008 05:46
 
dan said:

Hello All,

If you are experiencing problems with the TreeView (In particular using asynchronous call-backs) and you would like to BETA test the new version before release then please email me. We want to get this right in the next version and your help is greatly appreciated!

04/10/2008 06:23
 
Mikhail said:

Hello,
I'm trying to create nodes dymanically (version 4.2). I have a treeview control defined in the page xaml (no populate event handler thought).
In my own method I'm trying something like that:
treeMetaData.Clear();
NodeData ndata = new NodeData("0", "Offices", 1, "Images/folder.png", "Images/folderOpen.png", true);
Node nd = new Node(ndata);
treeMetaData.Nodes.Add(nd);
First, it did not show anything (treeview area empty). Also when on the subsequent call it give null reference exception calling Clear(). What am I doing wrong? Just to mention that example with populate method works just fine.


But, first I can not see

04/09/2008 06:56
 
dan said:

Hello,

At the moment: No, we are working on this right now, all we can suggest is to use the previous version 4.1 for now until we have a fix. Thanks for your patience!

04/09/2008 05:12
 
dan said:

Hello,

There seems to be an issue with the new tree version and asynchronous call-backs, we are looking at this at the moment. In th mean-time please use version 4.1 of the controls when requiring asynchronous population.

04/08/2008 02:15
 
rushtonmd said:

Hello-

In the old treeview, you could save the state of the TreeEventArgs e variable, then write to it later and it would populate. So, if you call an asynchronous web service, you could save the 'e' variable, then write to it once the web service came back. When I do this now, there is no change to the treeview (I'm guessing the TreeEventArgs object is no longer valid at that point). Is there a way to do this now? Thanks!

-MDR

04/08/2008 06:29
 
dan said:

A quick note about the new treeview, you no longer need to call the BuildRoot() method for the first time, as in the example above the tree is built automatically when it is loaded. You must, however setup your Populate() event handler.

04/06/2008 09:13
 
dan said:

Hello,

At the moment it is not possible to style the treeview, it may be something we will implement in the future, remember, if you have a specific requirement then please see our development services page.

03/29/2008 02:03
 
prejeshvp said:

is it possible to replace treeview scrollbar with style similar to scrollbar available with silverlight 2 beta contols

03/29/2008 12:17
 
dan said:

Hello,

This problem has just been pointed out to us, there are some issues with the XAML designer and 4.1 which we are currently looking at, thanks for your patience!

03/26/2008 01:28
 
LuckyWolf19 said:

I am using VS2005 and Expression Blend March Preview Beta 2 with support for Silverlight v2.0

03/25/2008 10:31
 
dan said:

Hello,

Are you using Visual Studio 2008 or Expression Blend? As these are not supported yet in Blend. Have you downloaded and tried the example zip?

03/25/2008 01:24
 
LuckyWolf19 said:

Just followed these instructions using version4.1 and Silverlight Beta 2 and got this error:

Cannot create an instance of "Tree"

Any thoughts?

03/24/2008 11:20
 
LuckyWolf19 said:

Just followed these instructions using version4.1 and Silverlight Beta 2 and got this error:

Cannot create an instance of "Tree"

Any thoughts?

03/24/2008 11:02
 
rushtonmd said:

Thanks Dan, that did the trick!!

-MDR

02/29/2008 01:40
 
dan said:

Hello,

You are right, there seems to be a bit of code not running when the Clear() method is called and having had a quick look at the code this method is not removing it from the containing Area control. This is a bug and has been added to the list of fixes for the next version.

To get around it for now you can need to call the ClearChildren() method of the containing Area control after you call the TreeView Clear() method, if your tree was called testTree then you would use:

testTree.Clear();
testTree.Area.ClearChildren();
testTree.BuildRoot();

Hope this helps.

02/29/2008 01:32
 
rushtonmd said:

Hello-

Controls are working great... that being said (haha)...

On the tree control, I'm trying to remove all the nodes and rebuild the tree. I used the treeView.Clear() method, and then use the debugger to ensure that the treeView.Count() = 0, which it does. The thing is, the root/base node doesn't get removed from the display, it still shows up in the treeview. I can do a treeView.BuildRoot(), and that rebuilds the root as it should, but it overlays it on the non-removed root/base node (you can tell because the text gets progressively darker whenever you do a Clear()-BuildRoot() combination. I think I might just be missing a flag or something, but any help would be appreciated. Thanks!

-MDR

02/28/2008 12:19
 
dan said:

Hello,

There does seem to be a problem with the tree when skinning is applied as you have found out. Some of the properties are not cascading down through the child nodes. This is a bug and has been added to the list of fixes for the next version which is due out on the 23rd Feb.

02/19/2008 04:25
 
j.grijmans said:

I have a dark background of this control, and I.m trying to set the text color to white. I'm using the skin line:
skins.Add("Tree.Node.Text.Foreground", white);
But only the top element has the white color. In the above example the "My documenys". All other elements still have the black text color.

How can I change this?

02/19/2008 02:41

Silverlight 3

Latest News

  • Silverlight 2 Controls V5.2.1 Released
    Jul, 03 2009

    After several months since the last release we have implemented many fixes to the controls library. The Rich TextBox has been improved with Links...

  • Silverlight 3 BETA Controls Released
    Mar, 30 2009

    As Silverlight 3 BETA is available now to test we thought we would present the Liquid Controls library for Silverlight 3. This BETA...

Silverlight 2 Controls

  • Rich TextBox

    Create and edit rich content with this slick and expandable Rich TextBox...

  • TreeView

    This easy to use TreeView comes with drag and drop, sorting, searching and much more...

  • Context Menu

    You too can have cool popup context menus in your Silverlight applications...

  • Resizable Dialog

    Draggable and resizable popup dialogs are what serious Silverlight developers need...

  • Spell Checker

    Real-time spell checking in Silverlight? We did it first here...