MAQ
MAQ

Reputation: 443

How to access custom property created in App.xaml.cs in Silverlight 4

I have created my own custom property in app.xaml.cs file I require to access this property in one of my viewmodel. When i try to access via Application object it does not show up. Can anyone help me with this.

Regards

Upvotes: 5

Views: 6925

Answers (2)

inside
inside

Reputation: 3177

Or simply Application.Current.Properties["YourSavePropertyKey"]

Upvotes: 0

Maheep
Maheep

Reputation: 5605

Use Application.Current to access custom property you have crated.

var currentApp =  Application.Current as App;
currentApp.YourPropertyName = "WhateverYouWant";

Read this article on MSDN with example on how to do it.

Upvotes: 16

Related Questions