Navigation-driven Silverlight applications tend to share some common pieces of UI. Traditionally, this has required sprinkling HyperlinkButtons throughout the application’s XAML. For ASP.NET a number of controls intended to drive navigation exist. These controls are driven by a sitemap, integrate well with authorization and roles (through sitemap trimming), and provide common user experiences around hierarchical application structures such as a TreeView-based list of hyperlinks and Breadcrumbs or navigation paths. These controls provide the user with context as to where in the application/site they currently are as well as where within the application they can go.
In this post, I’ll introduce a few controls that attempt to mimic this behavior in a Navigation-driven Silverlight application. I have added these controls to SLaB, and you’re welcome to use and modify them – or use them as examples for your own development – as you see fit. The controls are:
- TreeViewNavigator – a control which represents a sitemap as a TreeView
- BreadCrumbNavigator – a control which represents your current location within the sitemap’s link hierarchy and allows navigation back up the hierarchy as well as to siblings of any node within the hierarchy
If you’ve been following the evolution of my sample projects, you may have noticed some navigation UI that’s not built into the default navigation application template and has controls that look like the ones I’ve described above. Surprise, surprise!
You can see this in action here.
How does this type of UI work?
At its core, these controls have the same common set of functionality:
- Rendering UI based on a sitemap
- Keeping UI synchronized with the current page within the application
- Trimming the sitemap based upon the roles the current user belongs to and the metadata in the sitemap
The goal of these controls is to allow the navigation structure of an application to be exposed to a user in a declarative fashion, much as one can do using ASP.NET sitemaps. The API for the controls above uses Sitemaps that can be specified in XAML, but follow the same general structure as in ASP.NET.
For example, the sitemaps displayed above are produced by the following XAML:
<SLaB:Sitemap x:Key="Sitemap" Title="DavidPoll.com" Description="My homepage. Check it out and see what it's all about!"> <SLaB:SitemapNode TargetName="ContentFrame" Title="Home" Description="The home page." Uri="/Views/Home.xaml" /> <SLaB:SitemapNode Title="SLaB Features" Description="Demonstrations of Silverlight and Beyond features."> <SLaB:SitemapNode Title="Navigation"> <SLaB:SitemapNode Title="Local Pages"> <SLaB:SitemapNode TargetName="ContentFrame" Title="About" Description="The about page." Roles="Foo" Uri="/Views/About.xaml" /> <SLaB:SitemapNode TargetName="ContentFrame" Title="A broken link" Uri="/Views/NonExistent.xaml" /> </SLaB:SitemapNode> <SLaB:SitemapNode Title="On-Demand Xaps" Description="Pages in Xaps that will be loaded on-demand." TargetName="ContentFrame" Uri="/Views/SitemapPage.xaml?sitemapname=OnDemandSitemap"> <SLaB:SitemapNode Title="This Domain"> <SLaB:SitemapNode TargetName="ContentFrame" Title="Page in a big xap" Uri="pack://siteoforigin:,,SecondaryXap.xap/SecondaryXap;component/Page1.xaml" /> <SLaB:SitemapNode TargetName="ContentFrame" Title="Awesome Page" Uri="pack://siteoforigin:,,TernaryXap.xap/TernaryXap;component/AwesomePage.xaml" /> <SLaB:SitemapNode TargetName="ContentFrame" Title="Penguins (mapped Uri + metadata)" Uri="/remote/TernaryXap/AwesomePage.xaml?Site=http://www.davidpoll.com&First Name=David&Last Name=Poll&Title=Penguins!&Please rate..." /> </SLaB:SitemapNode> <SLaB:SitemapNode Title="Cross-Domain"> <SLaB:SitemapNode TargetName="ContentFrame" Title="http://open.depoll.com Page" Uri="pack://http:,,open.depoll.com,SimpleApplication,SimpleApplication.xap/SimpleApplication;component/Depoll.xaml?Source=http://open.depoll.com&File=wildlife.wmv" /> </SLaB:SitemapNode> </SLaB:SitemapNode> <SLaB:SitemapNode Title="Printing" Description="Pages that demonstrate printing utilities that simplify pagination of data and printing of complex data sets." TargetName="ContentFrame" Uri="/Views/SitemapPage.xaml?sitemapname=PrintingSitemap"> <SLaB:SitemapNode Title="Collection Printing (DataGrid)" Uri="pack://siteoforigin:,,ScratchPrintingProject.xap/ScratchPrintingProject;component/PrintingPage.xaml" TargetName="ContentFrame" /> <SLaB:SitemapNode Title="Collection Printing (Template-based)" Uri="pack://siteoforigin:,,ScratchPrintingProject.xap/ScratchPrintingProject;component/ItemTemplatePrinting.xaml" TargetName="ContentFrame" /> <SLaB:SitemapNode Title="Pre-defined page printing (Template-based)" Uri="pack://siteoforigin:,,ScratchPrintingProject.xap/ScratchPrintingProject;component/PredefinedPages.xaml" TargetName="ContentFrame" /> </SLaB:SitemapNode> <SLaB:SitemapNode Title="Useful XAML Tools"> <SLaB:SitemapNode TargetName="ContentFrame" Title="Demo (simple QueryString)" Uri="/Views/ObservableDictionaryDemo.xaml?a=b&c=d&e=f&g=h" /> <SLaB:SitemapNode TargetName="ContentFrame" Title="Demo (more complex QueryString)" Uri="/Views/ObservableDictionaryDemo.xaml?a=b&Name=David Eitan Poll&Url=http://www.davidpoll.com&No Value&Order=Dictionary" /> </SLaB:SitemapNode> </SLaB:SitemapNode> <SLaB:SitemapNode Title="DavidPoll.com"> <SLaB:SitemapNode TargetName="_blank" Title="Home Page" Uri="http://www.davidpoll.com" /> <SLaB:SitemapNode TargetName="_blank" Title="Navigation Posts" Uri="http://www.davidpoll.com/tag/navigation/" /> <SLaB:SitemapNode TargetName="_blank" Title="SLaB Posts" Uri="http://www.davidpoll.com/tag/silverlight-and-beyond-slab/" /> <SLaB:SitemapNode TargetName="_blank" Title="SLaB Download Page" Uri="http://www.davidpoll.com/downloads-and-samples/#SLaB" /> </SLaB:SitemapNode> </SLaB:SitemapNode> </SLaB:Sitemap>
You’ll note that the “About” link in the Sitemap above (bold/italic above) is missing from the TreeView. This is because the sitemaps do principal-based trimming of the sitemaps, ensuring that users only see the links they’re authorized to see.
In addition, the controls above stay in sync with the current page the user is viewing.
To get all of this functionality, there are three primary properties to set on the navigation controls (which derive from the Navigator abstract base class for this common functionality):
- Sitemap – usually, this is set to a Sitemap that is defined in resources somewhere, and may be shared across multiple navigation controls.
- CurrentSource – if the navigation control needs to stay in sync with the user’s current location (which is not always the case – e.g. on Error/404-ish pages), bind it to the CurrentSource of the Frame that it will be navigating
- Principal – if the navigation control should trim the sitemap based upon the User’s authorization, bind the Principal to be that of the current user. In the case of RIA Services, this can be done through the WebContext
Ultimately, using these controls just requires some simple XAML. For the TreeViewNavigator:
<SLaB:TreeViewNavigator CurrentSource="{Binding ElementName=ContentFrame, Path=CurrentSource}" Principal="{Binding User, Source={StaticResource WebContext}}" Sitemap="{StaticResource Sitemap}" />
And for the BreadCrumbNavigator:
<SLaB:BreadCrumbNavigator CurrentSource="{Binding CurrentSource, ElementName=ContentFrame}" Principal="{Binding User, Source={StaticResource WebContext}}" Sitemap="{StaticResource Sitemap}" />
What can I customize?
These controls are made to work with any ISitemap, which is, at its core, a container for a collection of ISitemapNodes. You can provide custom implementations of these, customizing your sitemaps to your heart’s content! For example, you might make sitemaps and sitemap nodes which:
- Retrieve their data from an ASP.NET xml-based sitemap file
- Authorize users for access to nodes based upon more than just roles
- Check authorization based on metadata on the page type itself, or by using a NavigationAuthorizer from the AuthContentLoader library
- Import one sitemap into another (I’ve actually provided an implementation of this in SLaB so that sitemaps and sub-sitemaps can be used)
Furthermore, the controls themselves are look-less, and you should be able to completely re-template them, customizing how hyperlinks are displayed, how much of the tree is expanded, and so on. If there’s something I’m missing, let me know!
So, can I see it in action?
Of course! You know I never leave you without a demo! In fact, today I’ve got two for you!
First, the SLaB demo application itself uses these controls. Click around and see how things behave. You’ll notice the controls are the centerpiece of the navigation UI, but also make appearances throughout the application, such as on “category pages” that list only the links within a particular section of the site, and on error pages within the application, making it easier for users to get back to useful locations within the application.
The second demo application is meant to show role-driven sitemap trimming. It uses WCF RIA Services to drive authentication and authorization, and shows and hides parts of the sitemap based upon the roles the user belongs to. You can log in using the following credentials:
User: Test
Password: _Testing
Experiment with the application and what happens to the navigation controls as you log in and log out. This also uses the AuthContentLoader from SLaB to perform additional authorization before actually loading any page.
The XAML for the sitemap in the application above shows how access can be restricted and how trimming takes effect:
<SLaB:Sitemap x:Key="Sitemap" Title="Scratch Business Application" Description="A sample RIA Services Business application that uses SLaB to represent its navigation and do authorization."> <SLaB:SitemapNode Title="Home" Description="The home page for the application" Uri="/Views/Home.xaml" /> <SLaB:SitemapNode Title="Broken Link" Description="A broken link" Uri="/Views/NonExistentPage.xaml" /> <SLaB:SitemapNode Title="Protected Pages (Non-Trimmed)" Description="Pages protected by authorization"> <SLaB:SitemapNode Title="About" Description="The About page for the application" Uri="/Views/About.xaml" /> <SLaB:SitemapNode Title="Page for registered users" Description="A page that can only be visited by registered users" Uri="/Views/RegisteredUsersPage.xaml" /> </SLaB:SitemapNode> <SLaB:SitemapNode Title="Protected Pages (Trimmed)" Roles="Registered Users" Description="Pages protected by authorization"> <SLaB:SitemapNode Title="About" Description="The About page for the application" Uri="/Views/About.xaml?trimmed" /> <SLaB:SitemapNode Title="Page for registered users" Description="A page that can only be visited by registered users" Uri="/Views/RegisteredUsersPage.xaml?trimmed" /> </SLaB:SitemapNode> <SLaB:SitemapNode Title="Protected Pages (Leaf nodes trimmed)" Description="Pages protected by authorization"> <SLaB:SitemapNode Title="About" Roles="Registered Users" Description="The About page for the application" Uri="/Views/About.xaml?leaftrimmed" /> <SLaB:SitemapNode Title="Page for registered users" Roles="Registered Users" Description="A page that can only be visited by registered users" Uri="/Views/RegisteredUsersPage.xaml?leaftrimmed" /> </SLaB:SitemapNode> <SLaB:SitemapNode Title="DavidPoll.com" Description="David Poll's homepage" Uri="http://www.davidpoll.com" TargetName="_blank" /> </SLaB:Sitemap>
Cool… but where are the bits?
Well, the good news is that you can get all of these controls in my Silverlight and Beyond (SLaB) libraries! Give them a shot and let me know what you think. What’s missing from these controls? What other pieces of user experience are you looking for? Are the behaviors of the TreeViewNavigator and BreadCrumbNavigator correct for your scenarios and desired UX?
With that said, here’s a summary of the links and access to the source!
SLaB v0.7 (includes source, a sample app, some tests, and binaries)
- For the latest version, please check out SLaB on my Downloads and Samples page.
- The v0.7 download of SLaB includes the following changes:
- Added TryImportResourceDictionary that allows XAML resource dictionaries to be imported but fail quietly (so that if not all dependencies for a control are met, other controls in the library (that share the same generic.xaml) can still be used.
- Added XamlDependencyAttribute, which ensures that Xaml-only assembly dependencies can be declared and appear as dependencies in the assembly metadata.
- Other minor bugfixes
- In the interim (since my last post with SLaB), I also produced the v0.6 version, which had the following changes:
- Made CollectionPrinter work for controls like DataGrid when they auto-generate columns for generic collections (based on the type in IEnumerable<T>)
- Added a utility method that allows you to get the MethodInfo for an arbitrary method, including private ones (from anywhere that the method is accessible)
- Other minor bugfixes
As always, I’d love to know what you think!

#1 by Les Prigmore on May 18, 2010 - 4:51 pm
Hi David,
Please let me start off with some sincere appreciation for what you are accomplishing with SLaB. I am trying to use it in a project but have a question about the SitemapNode.Roles property (i.e. as you mentioned above). I am using Slab ver 0.7. From what I can tell, all I need to do is include where “Role1;…” are the roles the I want to allow then the SitemapNode and its subordinates will be visible in the tree if the WebContext.Current.User.Roles contains at least one of the listed roles and not visible otherwise. However, I am not able to get this work for me. I searched the NavigationTests to verify what was going on, hoping that may also document your intent for how you intended for it to work, but was unable to find any tests for the SitemapNode control. Writing tests for dependency properties is currently a bit of a reach for some of us but, I for one, would be an eager to learn how if you could help us along by supplying a test for it.
Thanks again for SLaB and your help and support of SLaB……….Les
#2 by david.poll on May 24, 2010 - 10:17 am
Les,
I think the problem you’re having is that multiple roles are supposed to be separated by commas (,) rather than semicolons (;).
I’ll try to add some additional tests that help document this in the future. Let me know if that helps get you going.
-David
#3 by Les Prigmore on May 29, 2010 - 2:21 pm
Hi again David,
Thanks for your help! got the problems worked out everything is working just fine. I was all thrilled and stuff with the progress that I was making. Now the client says that they have to have menus. They just won’t warm up to the tree view approach. So my question is, is there any way that we can make this into a menu approach. I was hoping that I could turn it into a menu by styling it some way or something? If you think that that is possible, I would be totally grateful if you, or someone, could supply a small sample of how to go about styling it into a menu to get me started? Also, the loading of the tree view slows down when the sitemap nodes in the tree view approaches about 20. I am sure that I can conquer that problem by putting the pages into xaps that are downloaded on demand. I am eager to get your response because they are onto me to get something visual done as quickly as possible and here it is Memorial Day weekend and I am trying to whip something out as soon as I can while all of my friends are eating BBQ. I would love to be using your framework. I appreciate your help and wish you the best in the success of your framework……..Les
#4 by JD on May 26, 2010 - 1:06 pm
Excellent job, thank you.
#5 by Rui Marinho @ruiespinho on May 26, 2010 - 3:17 pm
Hi david.. you do it again, i m build a rich lob and i always end up to include SLAB in my app everytime you post, since my lob is ported from a asp.net one, one i had sitemap and all that stuff, the atutencation is working perfectly , ad now i think i will ad d the sitemap, from what i read this is a treeview right? i was using menu populated from riaservices to make the navigation, is eassier to style for me, so i can t have that with sitemap right? is a treewview by defaut and i can style the trevview ?! also other question, since i m usning Authcontentloader because of roles, and works great, do i have also to write the roles in the sitemap, can’t i make it read the NavigationAuthorizer and built itself on the fly from it? and i will be happier because i didn’t write any code?
ahaha
thansk for the great work, imo this is a must have for lob apps, it should be in the framework.
thanks
@ruiespinho
#6 by david.poll on May 28, 2010 - 11:26 am
Rui,
The TreeViewNavigator is a sitemap-based control that uses a TreeView in its control template. You can completely re-style this treeview, however (there’s a TreeViewStyle property on the TreeViewNavigator control). This can be a bit tricky b/c of some tricks I did in the control template’s XAML to get the right behavior out of the TreeView, but I think if you start with copying the existing style using Blend you’ll be alright.
As for using the NavigationAuthorizer, I’ve been trying to figure out how I want to reconcile these. You can certainly override ISitemapNode to use your NavigationAuthorizer to check access. Unfortunately, the NavigationAuthorizer works on post-mapping Uris, whereas the Sitemap needs to supply pre-mapping Uris (so if you have a UriMapper, this will break down a bit), but if that’s not a constraint for you, it shouldn’t be an issue.
Regardless, I’m glad to see you’re enjoying SLaB! Let me know if you encounter further difficulties.
#7 by Nic on May 28, 2010 - 4:47 am
Hi David,
Really appreciate what you are doing with SLaB. It is definitely filling a gap of functionality that we’d otherwise be hard pressed to implement ourselves.
I was wondering if you could assist on two points. Firstly, on a WinXP 32 bit system, I am having no problem building the SLaB 0.8 source. However on a Win 7 64 bit system I get these sort of errors:
Error 1 The “CreateExtmap” task could not be instantiated from “D:\Dev_03\scratch\SLaBv0.8\SLaB\Source\SLaB.Navigation.ContentLoaders.Utilities\../../Build Utils/CreateExtmap.exe”. Could not load file or assembly ‘file:///D:\Dev_03\scratch\SLaBv0.8\SLaB\Build Utils\CreateExtmap.exe’ or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0×80131515) D:\Dev_03\scratch\SLaBv0.8\SLaB\Source\SLaB.Navigation.ContentLoaders.Utilities\SLaB.Navigation.ContentLoaders.Utilities.csproj 113 5 SLaB.Navigation.ContentLoaders.Utilities
Error 2 The “CreateExtmap” task has been declared or used incorrectly, or failed during construction. Check the spelling of the task name and the assembly name. D:\Dev_03\scratch\SLaBv0.8\SLaB\Source\SLaB.Navigation.ContentLoaders.Utilities\SLaB.Navigation.ContentLoaders.Utilities.csproj 113 5 SLaB.Navigation.ContentLoaders.Utilities
Would it be possible to get the source for CreateExtmap.exe or provide a 64 bit version if that’s the issue?
The second problem I seem to be having is converting an existing project to use SLaB 0.8. I copied the sample ScratchContent project from SLaB 0.8 (did not use the RemoteControl mechanism in ScratchApplication; no sitemap either just a navigation frame). When I disable assembly caching everything works fine. However with assembly caching I get the following exception.
System.Exception: A failure in loading a xap occurred —> System.Exception: A failure in loading a xap occurred —> System.NullReferenceException: Object reference not set to an instance of an object.
at SLaB.Utilities.Xap.XapLoader.c__DisplayClass10.c__DisplayClass15.b__c()
at SLaB.Utilities.UiUtilities.ExecuteOnUiThread[T](Func`1 func)
at SLaB.Utilities.Xap.XapLoader.c__DisplayClass10.b__a(Object sender, OpenReadCompletedEventArgs args)
— End of inner exception stack trace —
at SLaB.Utilities.Xap.XapLoader.EndLoadXap(IAsyncResult result)
at SLaB.Utilities.Xap.XapLoader.c__DisplayClass2.b__1(IAsyncResult res)
— End of inner exception stack trace —
at SLaB.Navigation.ContentLoaders.Utilities.ContentLoaderBase.EndLoad(IAsyncResult asyncResult)
at SLaB.Navigation.ContentLoaders.Error.ErrorPageLoader.Loader.c__DisplayClass5.b__3(IAsyncResult res)
When I try assembly caching on the SLaB sample project it works fine so I’m unsure why I’m having a problem.
I guess I’ll have to migrate from scratch to figure out why it’s failing.
Thanks.
#8 by Nic on May 28, 2010 - 5:34 am
Hi David,
Some progress on the second point above. I had the below in my Silverlight application project to play around with localization.
en-US,fr,fr-FR
As a result some of the assembly cache generated zip files included a French resource dll. For example in System.Windows.Controls.zip I have:
/fr/System.Windows.Controls.resources.dll
/System.Windows.Controls.dll
When I switch to
the above zip only has
/System.Windows.Controls.dll
I believe this is the problem and remember one of your posts mentioning that a zip file should contain only one dll.
Would you be able to guide on next steps how to resolve this?
Thanks again.
#9 by Nic on May 28, 2010 - 5:38 am
Oops… forgot to wrap the code.
… play around with localization.
en-US,fr,fr-FR…When I switch to
[code][/code]
#10 by Nic on May 28, 2010 - 5:41 am
LOL, I can’t get it to display correctly.
Basically I mean the SupportedCultures tag with the above locales and then empty.
#11 by david.poll on May 28, 2010 - 7:18 am
Nic,
Thanks for the feedback. This is a scenario I hadn’t tried. I’ll try to take a look this weekend. The latest few versions of SLaB should have removed the one-dll-per-zip restriction, so my hope is that that isn’t the problem. I’ll let you know what I discover.
-David
#12 by david.poll on May 28, 2010 - 9:56 am
This turned out to be a bug in my ZipUtilities — the filenames returned use “\” as the folder delimiter rather than “/”, causing things within folders within zips not to be loaded. It’s a one-line fix that I’ll make tonight. My mistake!
#13 by david.poll on May 29, 2010 - 2:16 am
Fixed it. Also rebuilt CreateExtmap. Let me know if that fixes your problems on Win7. If not, I can share the source next time around (been avoiding it b/c it adds clutter to the zip files).
#14 by Nic on May 31, 2010 - 7:13 am
Hi David,
Thanks for the SLaB 0.85 update – it fixes the assembly caching problem with the multiple cultures enabled.
You were spot on with CreateExtMap – when I ‘unblocked’ it everything works fine. My bad
If you’re still willing to provide the source for CreateExtMap (maybe as a separate download) that would be awesome! I’d love to learn from it.
Thanks yet again,
Nic
#15 by Nic on May 28, 2010 - 1:36 pm
Excellent! Thanks David.
Regarding CreateExtMap, is the source code open source? I am still unable to have the solution build on a Win 7 64 bit machine.
#16 by Mark on July 18, 2011 - 8:23 am
Not sure if this old post is being monitored, but I had a question.
When you say the langauge issue was fixed, does that mean the fr folder is no longer so there is just the one DLL in the zip, or is the folder there and the SL&B can now handle it?
I have been trying to determine the use of these langauge files. With just fr-FR you do no get them, but with fr you do. It would seem if the resource files are required fr-FR would case the fr one to be added. Thanks in advance for any help.
#17 by david.poll on May 28, 2010 - 11:19 am
As to your first issue, I have no idea what’s causing that. I’ve never seen it before. I run on 64-bit Win7, so it’s definitely not that. I wonder if it’s a problem of when I originally built it (I think I may have been on the .NET 4.0 RC). I’ll try rebuilding it on my machine using the release version of .NET and we’ll see if that helps.
One thing to try — on Win7, make sure you’ve “unblocked” the zip file before you extract it (go to the properties for the file and click “Unblock”). Sometimes that causes problems when loading assemblies.
#18 by Andrew on May 28, 2010 - 5:56 am
Hi David!
How should I assign Uri property in SitemapNode to use following url:
#19 by david.poll on May 28, 2010 - 7:16 am
You should wrap your code in a code tag (see the note below the comment box) so that it appears correctly.
#20 by Andrew on May 28, 2010 - 9:28 am
Oopppsss
[code][/code]
#21 by Andrew on May 28, 2010 - 9:32 am
Hmmmm, something strange with those code tags…..
uriMapper:UriMapping Uri="Order/{id}" MappedUri="/Views/ViewOrder.xaml?id={id}"#22 by david.poll on May 28, 2010 - 9:36 am
So, in your SitemapNode, I’d expect to see something like:
<SLaB:SitemapNode Uri="Order/150" ... />
-David
#23 by Andrew on May 28, 2010 - 9:58 am
Thanks David, this works fine if we have static id, for example:
#Order/150
But id value is dynamic. It might be:
#Order/e64bb687-3c07-4e91-a76b-e97b23c2f151
or
#Order/4443be84-e3bd-4534-b034-98087e9265ec
How should i solve that Uri issue in SitemapNode?
#24 by david.poll on May 28, 2010 - 10:03 am
I’m not sure I understand your question. What would you like to appear in the list of links? Any particular SitemapNode corresponds to one (and only one) link (and may have some child nodes). However, you can implement the interface yourself to automatically populate the SitemapNode based on some schema/data backend you provide.
#25 by Andrew on May 28, 2010 - 10:51 am
I’m going to impelement that interface. Thank you!
#26 by Saurabh Aggarwal on October 27, 2010 - 8:00 pm
David,
First of all, you have done great work in SLaB! I think in general, a desired feature is to have the BreadCrumbNavigator be able to match URIs where only the QueryString is different as mentioned by Andrew (i.e. Order/150 and Order/151 are presumably the same URI or page except the order number or QueryString is different). This can be easily achieved by having a regex URI matching behavior (something you have in AuthContentLoader) on the BreadCrumbNavigator, rather than always compare Uri statically.
#27 by david.poll on November 11, 2010 - 5:16 pm
Interesting — I’ll consider this for a future update.
#28 by Dima on June 3, 2010 - 12:32 pm
Its a very good post. Thanks
#29 by Christopher Maduro on July 1, 2010 - 10:53 am
When I try to use RemoteControl with the standard silverlight business application template, it complains about the AuthenticationContext. http://forums.silverlight.net/forums/t/189569.aspx
#30 by Ketan on July 4, 2010 - 10:06 am
Hello David,
Can you please show us how we can directly plug in a custom SITEMAPDATASOURCE and use the above treeview kind of navigation (i.e. in SilverLight). We have a custom sitemapdatasource and we want to use Silverlight treeview like the one you have mentioned here, any help on that?
thank you.
#31 by Wolf on August 26, 2010 - 11:23 am
Hi David,
Really appreciate you blog & especially SL&B v.0.9. I tried to rebuild your SLaB solution and had no problems, however, when I delete the extmap.xml files (clean doesn’t remove these) I am getting errors during the rebuild. After a few cycles of rebuilds the errors clear up. To duplicate I delete the .extmap.xml file in SLaB\Source\SLaB.Navigation.ContentLoaders\Bin\Debug then rebuild and I get:
Error 1 The type or namespace name ‘CollectionPrinter’ could not be found (are you missing a using directive or an assembly reference?) C:\Users\Wolf\Documents\Visual Studio 2010\Projects\Samples\Navigation\SLaB\Source\ScratchPrintingProject\obj\Debug\TestPrinter.g.i.cs 36 40 ScratchPrintingProject
I looked at the project file and the only cause I can see is related to the CreateMapExt “using task”. I am not sure what this actually does, can you please explain? Also is there a reason why this is a using task versus a ‘After Build’ event?
Thanks,
Wolf
#32 by david.poll on August 29, 2010 - 1:25 pm
Wolf,
I’m glad you’re making good use of SLaB.
As for rebuilding, I’ve seen this error before (it happens to me occasionally too). I’ve found that usually closing the TestPrinter.xaml file resolves it. I’m still not sure why it’s happening, since all of the dependencies are indeed there.
The CreateExtmap task is there to generate the extmap files for all of my assemblies. It’s not an after-build event so that I can easily reuse it without being fully dependent on file paths, etc. It was just the solution I ultimately chose
. You can remove the task and things should still build correctly, although I’m not sure why you want to get rid of them.
Anyway, I hope that helps!
-David
#33 by Frank on November 4, 2010 - 7:23 am
Hello David,
Great Work.
For testting I use your ScratchBusinessApplication.
When I use your special value for an uri (e.g. ‘pack://http:,,open.depoll.com,SimpleApplication,SimpleApplication.xap/SimpleApplication;component/Depoll.xaml?Source=http://open.depoll.com&File=wildlife.wmv’ in the sitemapnode, I get an XamlParseException: ‘System.Uri’ aus dem Text ‘pack://http:,,open.depoll.com,SimpleApplication,SimpleApplication.xap/SimpleApplication;component/Depoll.xaml?Source=http://open.depoll.com&File=wildlife.wmv’ konnte nicht erstellt werden. [Line: 12 Position: 44] in the method ‘InitializeComponent’ of the ‘App’-class.
Any help on that?
Frank
#34 by david.poll on November 11, 2010 - 5:20 pm
It sounds like you’re not initializing your application to understand Pack Uris.
Take a look at this post — step 4 of the jump-start points out where/what you should call to make this work:
http://www.davidpoll.com/2010/02/01/on-demand-loading-of-assemblies-with-silverlight-navigation-revisited-for-silverlight-4-beta/
#35 by F. Sanchez on June 28, 2011 - 9:59 am
Hi David, first of all many thx for all this knowledge. I was wondering if it is possible to change the source of the Sitemap for BreadCrumbNavigator and the TreeViewNavigator from Sitemaps.xaml to a property on a viewmodel? So the sitemap can be build up dynamically there.. I actually tried this but both controls aren’t filled any longer..Any advice? thx in advance.
#36 by david.poll on July 3, 2011 - 2:30 am
Hmm… it should work — even when created dynamically. Out of curiosity, when you’re done changing the sitemap, set the source to null and then set it to the sitemap again (forcing it to re-bind). Does this work for you? If so, maybe the change notifications aren’t getting propagated properly (could be a bug in my code
)
#37 by F. Sanchez on July 4, 2011 - 5:06 am
Hi David, thx for your response. The actual problem was the TryImportResourceDictionary in the generic.xaml in the Theme folder not being called. I had moved the complete Theme folder to somewhere else in my application causing both controls not being visible any longer. The sitemap is now being constructed dynamically (composite sitemap) when prism modules are loaded. Thx again!