Skip to main content
Home Forums Silverlight Programming Silverlight Controls and Silverlight Toolkit Basics of Silverlight 2 TreeView Control?
7 replies. Latest Post by mlagrange on June 20, 2009.
(0)
mlagrange
Member
0 points
9 Posts
06-03-2009 11:37 PM |
Hello - I'm primarily an Access developer, moved into ASP.NET last year, and now I'm trying to learn Silverlight.
I have to (quickly!) work up a page that uses a TreeView to maintain data on a 3-level hierarchy. I've looked around on this site, and skimmed through the wealth of "Getting Started" videos, etc., but don't see anything specifically about the TreeView control.
Can somebody point me to tutorials or samples (preferably in VB, rather than C)?
Thanks very much
Mark
clint1222
Participant
1542 points
216 Posts
06-04-2009 12:10 AM |
Jesse Liberty usually has good tutorials: http://silverlight.net/blogs/jesseliberty/archive/2009/01/30/the-tree-view-control.aspx
Micheal Sync wrote up a good tutorial on the TreeView contol: http://michaelsync.net/2008/10/28/silverlight-toolkit-using-silverlight-treeview-control
06-04-2009 11:47 AM |
I'm looking at the Treeview sample on http://silverlight.net/samples/sl2/toolkitcontrolsamples/run/default.html
I've installed the SL Toolkit; it looks like it's there; I see all the controls.
I thought it would be simple enough to copy & paste the markup & vb code into the Page.xaml of a new Silverlight project, but I'm getting all sorts of errors that indicate I'm missing a lot of (or maybe just one?) references. I have the same ref's in that the 2nd tutorial you pointed to.
Is there something else I need for this sample code that wasn't included in the SL TK install?
Thanks for your response
06-04-2009 12:32 PM |
When adding the references add System.Windows.Controls.Toolkit
If you're going to cut and paste the xaml markup make sure your xmlns:control reference is to the toolkit
xmlns
Also make note of the known issues at the bottom of Michael's tutorial.
06-18-2009 12:49 AM |
Sorry I let this sit so long; I had to go do other things. I appreciate your help.
I am still getting the error messages below when I do a Build; any ideas as to what I'm still missing?
I have the reference to the toolkit:System.Windows.Controls.Toolkit .NET 2.0.5.0 True C:\Program Files\Microsoft SDKs\Silverlight\v2.0\Toolkit\March 2009\Libraries\System.Windows.Controls.Toolkit.dll
And I have the namespace declaration:xmlns:toolkit="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"(the only difference from your version is that I left it as "xmlns:toolkit=..." instead of "xmlns:control=...", because that is the qualifier used in the markup)
But I still get this slew of error messages:Error 1 'Diagnostics' is not a member of 'System'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\App.xaml.vb 21 16 SLTKTreeViewError 2 'Browser' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\App.xaml.vb 38 13 SLTKTreeViewError 3 Type 'System.Windows.Application' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 39 14 SLTKTreeViewError 4 Type 'System.Diagnostics.DebuggerNonUserCodeAttribute' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 46 6 SLTKTreeViewError 5 'Application' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 52 9 SLTKTreeViewError 6 Type 'System.Uri' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 52 58 SLTKTreeViewError 7 Type 'System.Windows.Controls.UserControl' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 39 14 SLTKTreeViewError 8 Type 'System.Windows.Controls.Grid' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 41 37 SLTKTreeViewError 9 Type 'System.Diagnostics.DebuggerNonUserCodeAttribute' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 48 6 SLTKTreeViewError 10 'Application' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 54 9 SLTKTreeViewError 11 Type 'System.Uri' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 54 58 SLTKTreeViewError 12 Type 'System.Windows.Controls.Grid' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 55 57 SLTKTreeViewError 13 Type 'System.Windows.Controls.UserControl' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 40 18 SLTKTreeViewError 14 Type 'System.Diagnostics.DebuggerNonUserCodeAttribute' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 47 10 SLTKTreeViewError 15 'Application' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 53 13 SLTKTreeViewError 16 Type 'System.Uri' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 53 62 SLTKTreeViewError 17 Copying file C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\Bin\Debug\SLTKTreeView.xap failed. Could not find file 'C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\Bin\Debug\SLTKTreeView.xap'. SLTKTreeView.Web
Thanks again!
06-18-2009 1:21 AM |
Hi,
Most of those errors are in the *.g.vb files, which are generated files. Most likely due to namespace issues, especially if you cut and pasted the xaml from the example.
Make sure the x:Class="*.*" in your xaml files match your project and class names (i.e. x:Class="ProjectName.ClassName"). You can delete the .g.vb files and rebuild the project to see if that gets rid of most of the errors.
Also readd the namespace reference by typing "xmlns:toolkit=" then selecting clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit from the list.
06-18-2009 2:52 AM |
> Make sure the x:Class="*.*" in your xaml files match your project and class names
That cleared up all but 3 of the error messages!
It's almost 2:00a where I'm at; I'll hit this again tomorrow
Thanks again for your help
06-20-2009 9:57 PM |
Ok, I started from scratch, and everything is working. I think I was merging lines from multiple samples, and made a mess of it.
Thanks for your help