Skip to main content

Microsoft Silverlight

Answered Question Basics of Silverlight 2 TreeView Control?RSS Feed

(0)

mlagrange
mlagrange

Member

Member

0 points

9 Posts

Basics of Silverlight 2 TreeView Control?

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
clint1222

Participant

Participant

1542 points

216 Posts

Answered Question

Re: Basics of Silverlight 2 TreeView Control?

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

mlagrange
mlagrange

Member

Member

0 points

9 Posts

Re: Basics of Silverlight 2 TreeView Control?

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

 

clint1222
clint1222

Participant

Participant

1542 points

216 Posts

Re: Basics of Silverlight 2 TreeView Control?

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:control="clr-namespace:System.Windows.Controls;assembly=System.Windows.Controls.Toolkit"

Also make note of the known issues at the bottom of Michael's tutorial.

mlagrange
mlagrange

Member

Member

0 points

9 Posts

Re: Basics of Silverlight 2 TreeView Control?

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 SLTKTreeView
Error 2 'Browser' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\App.xaml.vb 38 13 SLTKTreeView
Error 3 Type 'System.Windows.Application' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 39 14 SLTKTreeView
Error 4 Type 'System.Diagnostics.DebuggerNonUserCodeAttribute' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 46 6 SLTKTreeView
Error 5 'Application' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 52 9 SLTKTreeView
Error 6 Type 'System.Uri' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\App.g.vb 52 58 SLTKTreeView
Error 7 Type 'System.Windows.Controls.UserControl' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 39 14 SLTKTreeView
Error 8 Type 'System.Windows.Controls.Grid' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 41 37 SLTKTreeView
Error 9 Type 'System.Diagnostics.DebuggerNonUserCodeAttribute' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 48 6 SLTKTreeView
Error 10 'Application' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 54 9 SLTKTreeView
Error 11 Type 'System.Uri' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 54 58 SLTKTreeView
Error 12 Type 'System.Windows.Controls.Grid' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\Page.g.vb 55 57 SLTKTreeView
Error 13 Type 'System.Windows.Controls.UserControl' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 40 18 SLTKTreeView
Error 14 Type 'System.Diagnostics.DebuggerNonUserCodeAttribute' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 47 10 SLTKTreeView
Error 15 'Application' is not a member of 'Windows'. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 53 13 SLTKTreeView
Error 16 Type 'System.Uri' is not defined. C:\Inetpub\wwwroot\SLTKTreeView\SLTKTreeView\obj\Debug\TreeViewSample.g.vb 53 62 SLTKTreeView
Error 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!

clint1222
clint1222

Participant

Participant

1542 points

216 Posts

Re: Basics of Silverlight 2 TreeView Control?

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.

 

mlagrange
mlagrange

Member

Member

0 points

9 Posts

Re: Basics of Silverlight 2 TreeView Control?

> 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

mlagrange
mlagrange

Member

Member

0 points

9 Posts

Re: Basics of Silverlight 2 TreeView Control?

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

Mark

 

  • Unanswered Question
  • Answered Question
  • Announcement
Microsoft Communities