Tutorial Problem: Accessing Parent from child

[SIZE=2]In Blend I am getting Compile error when using method described in [/SIZE]http://www.kirupa.com/blend_silverlight/accessing_parent_pg1.htm
= [SIZE=2]The Type or namespace name “MainPage” could not be found (are you missing a directive or assembly reference?[/SIZE]) =

This is in the code-behind file where I added line[FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2]MainPage rootPage = Application.Current.RootVisual [/SIZE][/FONT][/SIZE][/FONT][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff][FONT=Courier New][SIZE=2][COLOR=#0000ff]as[/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][/COLOR][/SIZE][/FONT][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] MainPage;

[SIZE=1]Incidently I have trouble using App object in code-behind files as well, of a kind like
[/SIZE][FONT=Courier New][SIZE=2][FONT=Courier New][SIZE=2] App app = Application.Current;
[/SIZE][/FONT][/SIZE][/FONT][SIZE=1]with the same Type or namespace error; I made sure I got all the “using” statements like in the App.xaml.cs

[/SIZE]Actually I want to define a global var(s) on application level to store values I can access from various pages in SL application

Thanks for advice,[/SIZE][/FONT][/SIZE][/FONT]