Zayko in the Net

Personal blog of Vitaly Zayko

NAVIGATION - SEARCH

WP7: Changing ApplicationBar visibility generates NullReference exception

Faced an interesting problem: when I want to change ApplicationBar visibility by by changing instance IsVisible property, I always get NullReference exception. To avoid this use static member instead:

 ApplicationBar.IsVisible = true;

Guess why? Because ApplicationBar is not a Silverlight element and general behavior doesn’t apply to it.

Update: the same happens when you want to add/remove a button – so use static Button property.

Add comment