Pratik Kothari
Pratik Kothari

Reputation: 2446

bind to static property in app.xaml.cs for WP7

How can I bind to a static boolean property defined in App.xaml.cs in my wp7 page.xaml?

I have a static property - IsTrial (boolean) defined in App.xaml.cs and would like to bind to it to hide/show the AdControl from microsoft.

Upvotes: 1

Views: 1418

Answers (1)

Derek Lakin
Derek Lakin

Reputation: 16319

Silverlight 3 (upon which the Windows Phone 7 framework is built) does not support the x:Static markup extension, so you cannot bind to a static property. However, you can expose a "regular" read-only property that simply returns the value of the static property.

private static bool IsTrialCore
{
  get { // Your logic here. }
}

public bool IsTrial
{
  get { return IsTrailCore; }
}

Upvotes: 3

Related Questions