tags:

views:

14

answers:

1

What is the best way to manage links in a Silverlight application? In my app, I have various custom controls that will open a new website in a new window.

I know in the hosting aspx page you can pass in parameters but I don't know how and where to store these links internally? Should I add a collection to the App object? Is there another mechanism that already exists? Is it a good idea to make my custom controls take the links from a global scope object or the links should be passed in the constructor?

How do you do it?

+1  A: 

You have lots of options in Silverlight depending on what type of links they are, how many and how you want to maintain them.

If they are referenced by ID and updated occasionally, you could store them in a resource dictionary or a custom XAML file and load that on demand (XAML files are just object descriptions after all).

If you need to constantly maintain them, a database on the server would store them centrally and you would fetch them as needed via a service.

For lots in individual custom controls, that don't change links often, you could just make the hyperlink URL a property of the object and set the links in the XAML that contains the controls (this is the simplest option for the simplest usage). e.g.

<customControl Hyperlink="http://mylink.com/path/params/etc"/&gt;

Basically it comes down to how you want to manage them. If you drop us a line via our website contact page with specific details we will be happy to provide more detailed examples/suggestions.

Hope this helps.

Enough already