views:

200

answers:

3

I'm using silverlight, project structure is similiar to any other .net app. I have a map control that I would like to store what mode it is in (either road or aerial) so that other controls can access this.

Where do I put this enum variable, I plan to use 2 way binding on it so both are updated when either changes.

Thanks.

A: 

You probably will need to implement this as a property within a Singleton, if you want to use data binding in a clean manner.

Jon Skeet has a great post showing how to implement singletons in C#.

Reed Copsey
A: 

I found this link about global.asax and the application object helpful: http://odetocode.com/articles/89.aspx

"Which is better: storing object references in the Application object, or making static member variables and properties in the Global class..."

willemaster
A: 
  1. Add a property to your data model, or to a Singleton pattern as suggested by Reed.
  2. Follow the INotifyPropertyChanged pattern so that data binding will work.
WPCoder