Ibraheem Osama Mohamed (ابراهيم اسامه محمد)

Welcome to my blog :)

The type or namespace name ‘ApplicationViewStateChangedEventArgs’ does not exist in the namespace ‘Windows.UI.ViewManagement’

with 10 comments

Before starting in this post view this link http://social.msdn.microsoft.com/Forums/en-US/winappswithcsharp/thread/4e0bb840-2348-4db3-a2eb-03484902e124 it is a post about migrating Windows 8 Consumer with Release code
Once I upgrade form Consumer Preview I found that Error but I found a solution. There is two cases 1)You are using Consumer Preview SDK samples in Release Preview. 2)Or you built your own app using Consumer Preview and want it to run in Release Preview ( Error 1 The type or namespace name ‘ApplicationViewStateChangedEventArgs’ does not exist in the namespace ‘Windows.UI.ViewManagement’ (are you missing an assembly reference?) )Case 1 Solution : Download Windows 8 Release Preview SDK Samples which is not using ViewStateChangedEventArgs.  Here The Link to download but till now I don’t know why ViewSateChangedEventArgs exist in Consumer Preview and didn’t exist in Release preview Case 2 Solution : I found this solution by comparing the application of Release Preview with Consumer Preview. Take a copy for your application before start in this steps 🙂 This steps will make your application run . It Worked For Me  🙂 1)Open the common folder –> LayoutAwarePage.cs and Copy this code

using System;

using System.Collections.Generic;

using System.ComponentModel;

using System.Linq;

using Windows.Foundation;

using Windows.Foundation.Collections;

using Windows.System;

using Windows.UI.Core;

using Windows.UI.ViewManagement;

using Windows.UI.Xaml;

using Windows.UI.Xaml.Controls;

using Windows.Storage;

using Windows.Storage.Streams;

using Windows.UI.Xaml.Navigation;

using System.Threading.Tasks;

using System.IO;

using System.Runtime.Serialization;

namespace GridApplicationOne.Common

{

///<summary>

/// Typical implementation of Page that provides several important conveniences:

///<list type=”bullet”>

///<item>

///<description>Application view state to visual state mapping</description>

///</item>

///<item>

///<description>GoBack, GoForward, and GoHome event handlers</description>

///</item>

///<item>

///<description>Mouse and keyboard shortcuts for navigation</description>

///</item>

///<item>

///<description>State management for navigation and process lifetime management</description>

///</item>

///<item>

///<description>A default view model</description>

///</item>

///</list>

///</summary>

[Windows.Foundation.Metadata.WebHostHidden]

publicclassLayoutAwarePage : Page

{

///<summary>

/// Identifies the <see cref=”DefaultViewModel”/> dependency property.

///</summary>

publicstaticreadonlyDependencyProperty DefaultViewModelProperty =

DependencyProperty.Register(“DefaultViewModel”, typeof(IObservableMap<String, Object>),

typeof(LayoutAwarePage), null);

privateList<Control> _layoutAwareControls;

///<summary>

/// Initializes a new instance of the <see cref=”LayoutAwarePage”/> class.

///</summary>

public LayoutAwarePage()

{

if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) return;

// Create an empty default view model

this.DefaultViewModel = newObservableDictionary<String, Object>();

// When this page is part of the visual tree make two changes:

// 1) Map application view state to visual state for the page

// 2) Handle keyboard and mouse navigation requests

this.Loaded += (sender, e) =>

{

this.StartLayoutUpdates(sender, e);

// Keyboard and mouse navigation only apply when occupying the entire window

if (this.ActualHeight == Window.Current.Bounds.Height &&

this.ActualWidth == Window.Current.Bounds.Width)

{

// Listen to the window directly so focus isn’t required

Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated +=

CoreDispatcher_AcceleratorKeyActivated;

Window.Current.CoreWindow.PointerPressed +=

this.CoreWindow_PointerPressed;

}

};

// Undo the same changes when the page is no longer visible

this.Unloaded += (sender, e) =>

{

this.StopLayoutUpdates(sender, e);

Window.Current.CoreWindow.Dispatcher.AcceleratorKeyActivated -=

CoreDispatcher_AcceleratorKeyActivated;

Window.Current.CoreWindow.PointerPressed -=

this.CoreWindow_PointerPressed;

};

}

///<summary>

/// An implementation of <see cref=”IObservableMap&lt;String, Object&gt;”/> designed to be

/// used as a trivial view model.

///</summary>

protectedIObservableMap<String, Object> DefaultViewModel

{

get

{

returnthis.GetValue(DefaultViewModelProperty) asIObservableMap<String, Object>;

}

set

{

this.SetValue(DefaultViewModelProperty, value);

}

}

#region Navigation support

///<summary>

/// Invoked as an event handler to navigate backward in the page’s associated

///<see cref=”Frame”/> until it reaches the top of the navigation stack.

///</summary>

///<param name=”sender”>Instance that triggered the event.</param>

///<param name=”e”>Event data describing the conditions that led to the event.</param>

protectedvirtualvoid GoHome(object sender, RoutedEventArgs e)

{

// Use the navigation frame to return to the topmost page

if (this.Frame != null)

{

while (this.Frame.CanGoBack) this.Frame.GoBack();

}

}

///<summary>

/// Invoked as an event handler to navigate backward in the navigation stack

/// associated with this page’s <see cref=”Frame”/>.

///</summary>

///<param name=”sender”>Instance that triggered the event.</param>

///<param name=”e”>Event data describing the conditions that led to the

/// event.</param>

protectedvirtualvoid GoBack(object sender, RoutedEventArgs e)

{

// Use the navigation frame to return to the previous page

if (this.Frame != null && this.Frame.CanGoBack) this.Frame.GoBack();

}

///<summary>

/// Invoked as an event handler to navigate forward in the navigation stack

/// associated with this page’s <see cref=”Frame”/>.

///</summary>

///<param name=”sender”>Instance that triggered the event.</param>

///<param name=”e”>Event data describing the conditions that led to the

/// event.</param>

protectedvirtualvoid GoForward(object sender, RoutedEventArgs e)

{

// Use the navigation frame to move to the next page

if (this.Frame != null && this.Frame.CanGoForward) this.Frame.GoForward();

}

///<summary>

/// Invoked on every keystroke, including system keys such as Alt key combinations, when

/// this page is active and occupies the entire window. Used to detect keyboard navigation

/// between pages even when the page itself doesn’t have focus.

///</summary>

///<param name=”sender”>Instance that triggered the event.</param>

///<param name=”args”>Event data describing the conditions that led to the event.</param>

privatevoid CoreDispatcher_AcceleratorKeyActivated(CoreDispatcher sender,

AcceleratorKeyEventArgs args)

{

var virtualKey = args.VirtualKey;

// Only investigate further when Left, Right, or the dedicated Previous or Next keys

// are pressed

if ((args.EventType == CoreAcceleratorKeyEventType.SystemKeyDown ||

args.EventType == CoreAcceleratorKeyEventType.KeyDown) &&

(virtualKey == VirtualKey.Left || virtualKey == VirtualKey.Right ||

(int)virtualKey == 166 || (int)virtualKey == 167))

{

var coreWindow = Window.Current.CoreWindow;

var downState = CoreVirtualKeyStates.Down;

bool menuKey = (coreWindow.GetKeyState(VirtualKey.Menu) & downState) == downState;

bool controlKey = (coreWindow.GetKeyState(VirtualKey.Control) & downState) == downState;

bool shiftKey = (coreWindow.GetKeyState(VirtualKey.Shift) & downState) == downState;

bool noModifiers = !menuKey && !controlKey && !shiftKey;

bool onlyAlt = menuKey && !controlKey && !shiftKey;

if (((int)virtualKey == 166 && noModifiers) ||

(virtualKey == VirtualKey.Left && onlyAlt))

{

// When the previous key or Alt+Left are pressed navigate back

args.Handled = true;

this.GoBack(this, newRoutedEventArgs());

}

elseif (((int)virtualKey == 167 && noModifiers) ||

(virtualKey == VirtualKey.Right && onlyAlt))

{

// When the next key or Alt+Right are pressed navigate forward

args.Handled = true;

this.GoForward(this, newRoutedEventArgs());

}

}

}

///<summary>

/// Invoked on every mouse click, touch screen tap, or equivalent interaction when this

/// page is active and occupies the entire window. Used to detect browser-style next and

/// previous mouse button clicks to navigate between pages.

///</summary>

///<param name=”sender”>Instance that triggered the event.</param>

///<param name=”args”>Event data describing the conditions that led to the event.</param>

privatevoid CoreWindow_PointerPressed(CoreWindow sender,

PointerEventArgs args)

{

var properties = args.CurrentPoint.Properties;

// Ignore button chords with the left, right, and middle buttons

if (properties.IsLeftButtonPressed || properties.IsRightButtonPressed ||

properties.IsMiddleButtonPressed) return;

// If back or foward are pressed (but not both) navigate appropriately

bool backPressed = properties.IsXButton1Pressed;

bool forwardPressed = properties.IsXButton2Pressed;

if (backPressed ^ forwardPressed)

{

args.Handled = true;

if (backPressed) this.GoBack(this, newRoutedEventArgs());

if (forwardPressed) this.GoForward(this, newRoutedEventArgs());

}

}

#endregion

#region Visual state switching

///<summary>

/// Invoked as an event handler, typically on the <see cref=”FrameworkElement.Loaded”/>

/// event of a <see cref=”Control”/> within the page, to indicate that the sender should

/// start receiving visual state management changes that correspond to application view

/// state changes.

///</summary>

///<param name=”sender”>Instance of <see cref=”Control”/> that supports visual state

/// management corresponding to view states.</param>

///<param name=”e”>Event data that describes how the request was made.</param>

///<remarks>The current view state will immediately be used to set the corresponding

/// visual state when layout updates are requested. A corresponding

///<see cref=”FrameworkElement.Unloaded”/> event handler connected to

///<see cref=”StopLayoutUpdates”/> is strongly encouraged. Instances of

///<see cref=”LayoutAwarePage”/> automatically invoke these handlers in their Loaded and

/// Unloaded events.</remarks>

///<seealso cref=”DetermineVisualState”/>

///<seealso cref=”InvalidateVisualState”/>

publicvoid StartLayoutUpdates(object sender, RoutedEventArgs e)

{

var control = sender asControl;

if (control == null) return;

if (this._layoutAwareControls == null)

{

// Start listening to view state changes when there are controls interested in updates

Window.Current.SizeChanged += this.WindowSizeChanged;

this._layoutAwareControls = newList<Control>();

}

this._layoutAwareControls.Add(control);

// Set the initial visual state of the control

VisualStateManager.GoToState(control, DetermineVisualState(ApplicationView.Value), false);

}

privatevoid WindowSizeChanged(object sender, WindowSizeChangedEventArgs e)

{

this.InvalidateVisualState();

}

///<summary>

/// Invoked as an event handler, typically on the <see cref=”FrameworkElement.Unloaded”/>

/// event of a <see cref=”Control”/>, to indicate that the sender should start receiving

/// visual state management changes that correspond to application view state changes.

///</summary>

///<param name=”sender”>Instance of <see cref=”Control”/> that supports visual state

/// management corresponding to view states.</param>

///<param name=”e”>Event data that describes how the request was made.</param>

///<remarks>The current view state will immediately be used to set the corresponding

/// visual state when layout updates are requested.</remarks>

///<seealso cref=”StartLayoutUpdates”/>

publicvoid StopLayoutUpdates(object sender, RoutedEventArgs e)

{

var control = sender asControl;

if (control == null || this._layoutAwareControls == null) return;

this._layoutAwareControls.Remove(control);

if (this._layoutAwareControls.Count == 0)

{

// Stop listening to view state changes when no controls are interested in updates

this._layoutAwareControls = null;

Window.Current.SizeChanged -= this.WindowSizeChanged;

}

}

///<summary>

/// Translates <see cref=”ApplicationViewState”/> values into strings for visual state

/// management within the page. The default implementation uses the names of enum values.

/// Subclasses may override this method to control the mapping scheme used.

///</summary>

///<param name=”viewState”>View state for which a visual state is desired.</param>

///<returns>Visual state name used to drive the

///<see cref=”VisualStateManager”/></returns>

///<seealso cref=”InvalidateVisualState”/>

protectedvirtualstring DetermineVisualState(ApplicationViewState viewState)

{

return viewState.ToString();

}

///<summary>

/// Updates all controls that are listening for visual state changes with the correct

/// visual state.

///</summary>

///<remarks>

/// Typically used in conjunction with overriding <see cref=”DetermineVisualState”/> to

/// signal that a different value may be returned even though the view state has not

/// changed.

///</remarks>

publicvoid InvalidateVisualState()

{

if (this._layoutAwareControls != null)

{

string visualState = DetermineVisualState(ApplicationView.Value);

foreach (var layoutAwareControl inthis._layoutAwareControls)

{

VisualStateManager.GoToState(layoutAwareControl, visualState, false);

}

}

}

#endregion

#region Process lifetime management

privateString _pageKey;

///<summary>

/// Invoked when this page is about to be displayed in a Frame.

///</summary>

///<param name=”e”>Event data that describes how this page was reached. The Parameter

/// property provides the group to be displayed.</param>

protectedoverridevoid OnNavigatedTo(NavigationEventArgs e)

{

// Returning to a cached page through navigation shouldn’t trigger state loading

if (this._pageKey != null) return;

var frameState = SuspensionManager.SessionStateForFrame(this.Frame);

this._pageKey = “Page-” + this.Frame.BackStackDepth;

if (e.NavigationMode == NavigationMode.New)

{

// Clear existing state for forward navigation when adding a new page to the

// navigation stack

var nextPageKey = this._pageKey;

int nextPageIndex = this.Frame.BackStackDepth;

while (frameState.Remove(nextPageKey))

{

nextPageIndex++;

nextPageKey = “Page-” + nextPageIndex;

}

// Pass the navigation parameter to the new page

this.LoadState(e.Parameter, null);

}

else

{

// Pass the navigation parameter and preserved page state to the page, using

// the same strategy for loading suspended state and recreating pages discarded

// from cache

this.LoadState(e.Parameter, (Dictionary<String, Object>)frameState[this._pageKey]);

}

}

///<summary>

/// Invoked when this page will no longer be displayed in a Frame.

///</summary>

///<param name=”e”>Event data that describes how this page was reached. The Parameter

/// property provides the group to be displayed.</param>

protectedoverridevoid OnNavigatedFrom(NavigationEventArgs e)

{

var frameState = SuspensionManager.SessionStateForFrame(this.Frame);

var pageState = newDictionary<String, Object>();

this.SaveState(pageState);

frameState[_pageKey] = pageState;

}

///<summary>

/// Populates the page with content passed during navigation. Any saved state is also

/// provided when recreating a page from a prior session.

///</summary>

///<param name=”navigationParameter”>The parameter value passed to

///<see cref=”Frame.Navigate(Type, Object)”/> when this page was initially requested.

///</param>

///<param name=”pageState”>A dictionary of state preserved by this page during an earlier

/// session. This will be null the first time a page is visited.</param>

protectedvirtualvoid LoadState(Object navigationParameter, Dictionary<String, Object> pageState)

{

}

///<summary>

/// Preserves state associated with this page in case the application is suspended or the

/// page is discarded from the navigation cache. Values must conform to the serialization

/// requirements of <see cref=”SuspensionManager.SessionState”/>.

///</summary>

///<param name=”pageState”>An empty dictionary to be populated with serializable state.</param>

protectedvirtualvoid SaveState(Dictionary<String, Object> pageState)

{

}

#endregion

///<summary>

/// Implementation of IObservableMap that supports reentrancy for use as a default view

/// model.

///</summary>

privateclassObservableDictionary<K, V> : IObservableMap<K, V>

{

privateclassObservableDictionaryChangedEventArgs : IMapChangedEventArgs<K>

{

public ObservableDictionaryChangedEventArgs(CollectionChange change, K key)

{

this.CollectionChange = change;

this.Key = key;

}

publicCollectionChange CollectionChange { get; privateset; }

public K Key { get; privateset; }

}

privateDictionary<K, V> _dictionary = newDictionary<K, V>();

publiceventMapChangedEventHandler<K, V> MapChanged;

privatevoid InvokeMapChanged(CollectionChange change, K key)

{

var eventHandler = MapChanged;

if (eventHandler != null)

{

eventHandler(this, newObservableDictionaryChangedEventArgs(CollectionChange.ItemInserted, key));

}

}

publicvoid Add(K key, V value)

{

this._dictionary.Add(key, value);

this.InvokeMapChanged(CollectionChange.ItemInserted, key);

}

publicvoid Add(KeyValuePair<K, V> item)

{

this.Add(item.Key, item.Value);

}

publicbool Remove(K key)

{

if (this._dictionary.Remove(key))

{

this.InvokeMapChanged(CollectionChange.ItemRemoved, key);

returntrue;

}

returnfalse;

}

publicbool Remove(KeyValuePair<K, V> item)

{

V currentValue;

if (this._dictionary.TryGetValue(item.Key, out currentValue) &&

Object.Equals(item.Value, currentValue) && this._dictionary.Remove(item.Key))

{

this.InvokeMapChanged(CollectionChange.ItemRemoved, item.Key);

returntrue;

}

returnfalse;

}

public V this[K key]

{

get

{

returnthis._dictionary[key];

}

set

{

this._dictionary[key] = value;

this.InvokeMapChanged(CollectionChange.ItemChanged, key);

}

}

publicvoid Clear()

{

var priorKeys = this._dictionary.Keys.ToArray();

this._dictionary.Clear();

foreach (var key in priorKeys)

{

this.InvokeMapChanged(CollectionChange.ItemRemoved, key);

}

}

publicICollection<K> Keys

{

get { returnthis._dictionary.Keys; }

}

publicbool ContainsKey(K key)

{

returnthis._dictionary.ContainsKey(key);

}

publicbool TryGetValue(K key, out V value)

{

returnthis._dictionary.TryGetValue(key, out value);

}

publicICollection<V> Values

{

get { returnthis._dictionary.Values; }

}

publicbool Contains(KeyValuePair<K, V> item)

{

returnthis._dictionary.Contains(item);

}

publicint Count

{

get { returnthis._dictionary.Count; }

}

publicbool IsReadOnly

{

get { returnfalse; }

}

publicIEnumerator<KeyValuePair<K, V>> GetEnumerator()

{

returnthis._dictionary.GetEnumerator();

}

System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()

{

returnthis._dictionary.GetEnumerator();

}

publicvoid CopyTo(KeyValuePair<K, V>[] array, int arrayIndex)

{

int arraySize = array.Length;

foreach (var pair inthis._dictionary)

{

if (arrayIndex >= arraySize) break;

array[arrayIndex++] = pair;

}

}

}

}

internalsealedclassSuspensionManager

{

privatestaticDictionary<string, object> _sessionState = newDictionary<string, object>();

privatestaticList<Type> _knownTypes = newList<Type>();

privateconststring sessionStateFilename = “_sessionState.xml”;

///<summary>

/// Provides access to global session state for the current session. This state is

/// serialized by <see cref=”SaveAsync”/> and restored by

///<see cref=”RestoreAsync”/>, so values must be serializable by

///<see cref=”DataContractSerializer”/> and should be as compact as possible. Strings

/// and other self-contained data types are strongly recommended.

///</summary>

publicstaticDictionary<string, object> SessionState

{

get { return _sessionState; }

}

///<summary>

/// List of custom types provided to the <see cref=”DataContractSerializer”/> when

/// reading and writing session state. Initially empty, additional types may be

/// added to customize the serialization process.

///</summary>

publicstaticList<Type> KnownTypes

{

get { return _knownTypes; }

}

///<summary>

/// Save the current <see cref=”SessionState”/>. Any <see cref=”Frame”/> instances

/// registered with <see cref=”RegisterFrame”/> will also preserve their current

/// navigation stack, which in turn gives their active <see cref=”Page”/> an opportunity

/// to save its state.

///</summary>

///<returns>An asynchronous task that reflects when session state has been saved.</returns>

publicstaticasyncTask SaveAsync()

{

// Save the navigation state for all registered frames

foreach (var weakFrameReference in _registeredFrames)

{

Frame frame;

if (weakFrameReference.TryGetTarget(out frame))

{

SaveFrameNavigationState(frame);

}

}

// Serialize the session state synchronously to avoid asynchronous access to shared

// state

MemoryStream sessionData = newMemoryStream();

DataContractSerializer serializer = newDataContractSerializer(typeof(Dictionary<string, object>), _knownTypes);

serializer.WriteObject(sessionData, _sessionState);

// Get an output stream for the SessionState file and write the state asynchronously

StorageFile file = awaitApplicationData.Current.LocalFolder.CreateFileAsync(sessionStateFilename, CreationCollisionOption.ReplaceExisting);

using (Stream fileStream = await file.OpenStreamForWriteAsync())

{

sessionData.Seek(0, SeekOrigin.Begin);

await sessionData.CopyToAsync(fileStream);

await fileStream.FlushAsync();

}

}

///<summary>

/// Restores previously saved <see cref=”SessionState”/>. Any <see cref=”Frame”/> instances

/// registered with <see cref=”RegisterFrame”/> will also restore their prior navigation

/// state, which in turn gives their active <see cref=”Page”/> an opportunity restore its

/// state.

///</summary>

///<returns>An asynchronous task that reflects when session state has been read. The

/// content of <see cref=”SessionState”/> should not be relied upon until this task

/// completes.</returns>

publicstaticasyncTask RestoreAsync()

{

_sessionState = newDictionary<String, Object>();

// Get the input stream for the SessionState file

StorageFile file = awaitApplicationData.Current.LocalFolder.GetFileAsync(sessionStateFilename);

using (IInputStream inStream = await file.OpenSequentialReadAsync())

{

// Deserialize the Session State

DataContractSerializer serializer = newDataContractSerializer(typeof(Dictionary<string, object>), _knownTypes);

_sessionState = (Dictionary<string, object>)serializer.ReadObject(inStream.AsStreamForRead());

}

// Restore any registered frames to their saved state

foreach (var weakFrameReference in _registeredFrames)

{

Frame frame;

if (weakFrameReference.TryGetTarget(out frame))

{

frame.ClearValue(FrameSessionStateProperty);

RestoreFrameNavigationState(frame);

}

}

}

privatestaticDependencyProperty FrameSessionStateKeyProperty =

DependencyProperty.RegisterAttached(“_FrameSessionStateKey”, typeof(String), typeof(SuspensionManager), null);

privatestaticDependencyProperty FrameSessionStateProperty =

DependencyProperty.RegisterAttached(“_FrameSessionState”, typeof(Dictionary<String, Object>), typeof(SuspensionManager), null);

privatestaticList<WeakReference<Frame>> _registeredFrames = newList<WeakReference<Frame>>();

///<summary>

/// Registers a <see cref=”Frame”/> instance to allow its navigation history to be saved to

/// and restored from <see cref=”SessionState”/>. Frames should be registered once

/// immediately after creation if they will participate in session state management. Upon

/// registration if state has already been restored for the specified key

/// the navigation history will immediately be restored. Subsequent invocations of

///<see cref=”RestoreAsync”/> will also restore navigation history.

///</summary>

///<param name=”frame”>An instance whose navigation history should be managed by

///<see cref=”SuspensionManager”/></param>

///<param name=”sessionStateKey”>A unique key into <see cref=”SessionState”/> used to

/// store navigation-related information.</param>

publicstaticvoid RegisterFrame(Frame frame, String sessionStateKey)

{

if (frame.GetValue(FrameSessionStateKeyProperty) != null)

{

thrownewInvalidOperationException(“Frames can only be registered to one session state key”);

}

if (frame.GetValue(FrameSessionStateProperty) != null)

{

thrownewInvalidOperationException(“Frames must be either be registered before accessing frame session state, or not registered at all”);

}

// Use a dependency property to associate the session key with a frame, and keep a list of frames whose

// navigation state should be managed

frame.SetValue(FrameSessionStateKeyProperty, sessionStateKey);

_registeredFrames.Add(newWeakReference<Frame>(frame));

// Check to see if navigation state can be restored

RestoreFrameNavigationState(frame);

}

///<summary>

/// Disassociates a <see cref=”Frame”/> previously registered by <see cref=”RegisterFrame”/>

/// from <see cref=”SessionState”/>. Any navigation state previously captured will be

/// removed.

///</summary>

///<param name=”frame”>An instance whose navigation history should no longer be

/// managed.</param>

publicstaticvoid UnregisterFrame(Frame frame)

{

// Remove session state and remove the frame from the list of frames whose navigation

// state will be saved (along with any weak references that are no longer reachable)

SessionState.Remove((String)frame.GetValue(FrameSessionStateKeyProperty));

_registeredFrames.RemoveAll((weakFrameReference) =>

{

Frame testFrame;

return !weakFrameReference.TryGetTarget(out testFrame) || testFrame == frame;

});

}

///<summary>

/// Provides storage for session state associated with the specified <see cref=”Frame”/>.

/// Frames that have been previously registered with <see cref=”RegisterFrame”/> have

/// their session state saved and restored automatically as a part of the global

///<see cref=”SessionState”/>. Frames that are not registered have transient state

/// that can still be useful when restoring pages that have been discarded from the

/// navigation cache.

///</summary>

///<remarks>Apps may choose to rely on <see cref=”LayoutAwarePage”/> to manage

/// page-specific state instead of working with frame session state directly.</remarks>

///<param name=”frame”>The instance for which session state is desired.</param>

///<returns>A collection of state subject to the same serialization mechanism as

///<see cref=”SessionState”/>.</returns>

publicstaticDictionary<String, Object> SessionStateForFrame(Frame frame)

{

var frameState = (Dictionary<String, Object>)frame.GetValue(FrameSessionStateProperty);

if (frameState == null)

{

var frameSessionKey = (String)frame.GetValue(FrameSessionStateKeyProperty);

if (frameSessionKey != null)

{

// Registered frames reflect the corresponding session state

if (!_sessionState.ContainsKey(frameSessionKey))

{

_sessionState[frameSessionKey] = newDictionary<String, Object>();

}

frameState = (Dictionary<String, Object>)_sessionState[frameSessionKey];

}

else

{

// Frames that aren’t registered have transient state

frameState = newDictionary<String, Object>();

}

frame.SetValue(FrameSessionStateProperty, frameState);

}

return frameState;

}

privatestaticvoid RestoreFrameNavigationState(Frame frame)

{

var frameState = SessionStateForFrame(frame);

if (frameState.ContainsKey(“Navigation”))

{

frame.SetNavigationState((String)frameState[“Navigation”]);

}

}

privatestaticvoid SaveFrameNavigationState(Frame frame)

{

var frameState = SessionStateForFrame(frame);

frameState[“Navigation”] = frame.GetNavigationState();

}

}

}

2)Change the namespace name to your application name.common in the LayoutAwarePage.cs 3)Open the StandardStyles.Xaml and Copy this code in it

<!–This file contains XAML styles that simplify application development.

These are not merely convenient, but are required by most Visual Studio project and item templates.

Removing, renaming, or otherwise modifying the content of these files may result in a project that

does not build, or that will not build once additional pages are added. If variations on these

styles are desired it is recommended that you copy the content under a new name and modify your

private copy.

–>

<ResourceDictionary

xmlns=”http://schemas.microsoft.com/winfx/2006/xaml/presentation&#8221;

xmlns:x=”http://schemas.microsoft.com/winfx/2006/xaml”&gt;

    <!– Non-brush values that vary across themes –>

    <ResourceDictionary.ThemeDictionaries>

        <ResourceDictionary x:Key=”Default”>

            <x:String x:Key=”BackButtonGlyph”></x:String>

            <x:String x:Key=”BackButtonSnappedGlyph”></x:String>

        </ResourceDictionary>

        <ResourceDictionary x:Key=”HighContrast”>

            <x:String x:Key=”BackButtonGlyph”></x:String>

            <x:String x:Key=”BackButtonSnappedGlyph”></x:String>

        </ResourceDictionary>

    </ResourceDictionary.ThemeDictionaries>

    <!– RichTextBlock styles –>

    <Style x:Key=”BasicRichTextStyle” TargetType=”RichTextBlock”>

        <Setter Property=”Foreground” Value=”{StaticResource ApplicationForegroundThemeBrush}”/>

        <Setter Property=”FontSize” Value=”{StaticResource ControlContentThemeFontSize}”/>

        <Setter Property=”FontFamily” Value=”{StaticResource ContentControlThemeFontFamily}”/>

        <Setter Property=”TextTrimming” Value=”WordEllipsis”/>

        <Setter Property=”TextWrapping” Value=”Wrap”/>

        <Setter Property=”Typography.StylisticSet20″ Value=”True”/>

        <Setter Property=”Typography.DiscretionaryLigatures” Value=”True”/>

        <Setter Property=”Typography.CaseSensitiveForms” Value=”True”/>

    </Style>

    <Style x:Key=”BaselineRichTextStyle” TargetType=”RichTextBlock” BasedOn=”{StaticResource BasicRichTextStyle}”>

        <Setter Property=”LineHeight” Value=”20″/>

        <Setter Property=”LineStackingStrategy” Value=”BlockLineHeight”/>

        <!– Properly align text along its baseline –>

        <Setter Property=”RenderTransform”>

            <Setter.Value>

                <TranslateTransform X=”-1″ Y=”4″/>

            </Setter.Value>

        </Setter>

    </Style>

    <Style x:Key=”ItemRichTextStyle” TargetType=”RichTextBlock” BasedOn=”{StaticResource BaselineRichTextStyle}”/>

    <Style x:Key=”BodyRichTextStyle” TargetType=”RichTextBlock” BasedOn=”{StaticResource BaselineRichTextStyle}”>

        <Setter Property=”FontWeight” Value=”SemiLight”/>

    </Style>

    <Style x:Key=”BasicTextStyle” TargetType=”TextBlock”>

        <Setter Property=”Foreground” Value=”{StaticResource ApplicationForegroundThemeBrush}”/>

        <Setter Property=”FontSize” Value=”{StaticResource ControlContentThemeFontSize}”/>

        <Setter Property=”FontFamily” Value=”{StaticResource ContentControlThemeFontFamily}”/>

        <Setter Property=”TextTrimming” Value=”WordEllipsis”/>

        <Setter Property=”TextWrapping” Value=”Wrap”/>

        <Setter Property=”Typography.StylisticSet20″ Value=”True”/>

        <Setter Property=”Typography.DiscretionaryLigatures” Value=”True”/>

        <Setter Property=”Typography.CaseSensitiveForms” Value=”True”/>

    </Style>

    <Style x:Key=”BaselineTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource BasicTextStyle}”>

        <Setter Property=”LineHeight” Value=”20″/>

        <Setter Property=”LineStackingStrategy” Value=”BlockLineHeight”/>

        <Setter Property=”RenderTransform”>

            <Setter.Value>

                <TranslateTransform X=”-1″ Y=”4″/>

            </Setter.Value>

        </Setter>

    </Style>

    <Style x:Key=”HeaderTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource BaselineTextStyle}”>

        <Setter Property=”FontSize” Value=”56″/>

        <Setter Property=”FontWeight” Value=”Light”/>

        <Setter Property=”LineHeight” Value=”40″/>

        <Setter Property=”RenderTransform”>

            <Setter.Value>

                <TranslateTransform X=”-2″ Y=”8″/>

            </Setter.Value>

        </Setter>

    </Style>

    <Style x:Key=”SubheaderTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource BaselineTextStyle}”>

        <Setter Property=”FontSize” Value=”26.667″/>

        <Setter Property=”FontWeight” Value=”Light”/>

        <Setter Property=”LineHeight” Value=”30″/>

        <Setter Property=”RenderTransform”>

            <Setter.Value>

                <TranslateTransform X=”-1″ Y=”6″/>

            </Setter.Value>

        </Setter>

    </Style>

    <Style x:Key=”TitleTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource BaselineTextStyle}”>

        <Setter Property=”FontWeight” Value=”SemiBold”/>

    </Style>

    <Style x:Key=”ItemTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource BaselineTextStyle}”/>

    <Style x:Key=”BodyTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource BaselineTextStyle}”>

        <Setter Property=”FontWeight” Value=”SemiLight”/>

    </Style>

    <Style x:Key=”CaptionTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource BaselineTextStyle}”>

        <Setter Property=”FontSize” Value=”12″/>

        <Setter Property=”Foreground” Value=”{StaticResource ApplicationSecondaryForegroundThemeBrush}”/>

    </Style>

    <Style x:Key=”TextButtonStyle” TargetType=”Button”>

        <Setter Property=”MinWidth” Value=”0″/>

        <Setter Property=”MinHeight” Value=”0″/>

        <Setter Property=”Template”>

            <Setter.Value>

                <ControlTemplate TargetType=”Button”>

                    <Grid Background=”Transparent”>

                        <TextBlock

x:Name=”Text”

Text=”{TemplateBinding Content}”

Margin=”3,-7,3,10″

TextWrapping=”NoWrap”

Style=”{StaticResource SubheaderTextStyle}”/>

                        <Rectangle

x:Name=”FocusVisualWhite”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualWhiteStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”1.5″/>

                        <Rectangle

x:Name=”FocusVisualBlack”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualBlackStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”0.5″/>

                        <VisualStateManager.VisualStateGroups>

                            <VisualStateGroup x:Name=”CommonStates”>

                                <VisualState x:Name=”Normal”/>

                                <VisualState x:Name=”PointerOver”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Text” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource ApplicationPointerOverForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Pressed”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Text” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource ApplicationPressedForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Disabled”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Text” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource ButtonDisabledForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                            </VisualStateGroup>

                            <VisualStateGroup x:Name=”FocusStates”>

                                <VisualState x:Name=”Focused”>

                                    <Storyboard>

                                        <DoubleAnimation Duration=”0″ To=”1″ Storyboard.TargetName=”FocusVisualWhite” Storyboard.TargetProperty=”Opacity”/>

                                        <DoubleAnimation Duration=”0″ To=”1″ Storyboard.TargetName=”FocusVisualBlack” Storyboard.TargetProperty=”Opacity”/>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Unfocused”/>

                            </VisualStateGroup>

                        </VisualStateManager.VisualStateGroups>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

    <!–

TextRadioButtonStyle is used to style a RadioButton using subheader-styled text with no other adornment.

This style is used in the SearchResultsPage to allow selection among filters.

–>

    <Style x:Key=”TextRadioButtonStyle” TargetType=”RadioButton”>

        <Setter Property=”MinWidth” Value=”0″/>

        <Setter Property=”MinHeight” Value=”0″/>

        <Setter Property=”Margin” Value=”0,0,30,0″/>

        <Setter Property=”Template”>

            <Setter.Value>

                <ControlTemplate TargetType=”RadioButton”>

                    <Grid Background=”Transparent”>

                        <TextBlock

x:Name=”Text”

Text=”{TemplateBinding Content}”

Margin=”3,-7,3,10″

TextWrapping=”NoWrap”

Style=”{StaticResource SubheaderTextStyle}”/>

                        <Rectangle

x:Name=”FocusVisualWhite”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualWhiteStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”1.5″/>

                        <Rectangle

x:Name=”FocusVisualBlack”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualBlackStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”0.5″/>

                        <VisualStateManager.VisualStateGroups>

                            <VisualStateGroup x:Name=”CommonStates”>

                                <VisualState x:Name=”Normal”/>

                                <VisualState x:Name=”PointerOver”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Text” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource ApplicationPointerOverForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Pressed”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Text” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource ApplicationPressedForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Disabled”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Text” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource ButtonDisabledForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                            </VisualStateGroup>

                            <VisualStateGroup x:Name=”FocusStates”>

                                <VisualState x:Name=”Focused”>

                                    <Storyboard>

                                        <DoubleAnimation Duration=”0″ To=”1″ Storyboard.TargetName=”FocusVisualWhite” Storyboard.TargetProperty=”Opacity”/>

                                        <DoubleAnimation Duration=”0″ To=”1″ Storyboard.TargetName=”FocusVisualBlack” Storyboard.TargetProperty=”Opacity”/>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Unfocused”/>

                            </VisualStateGroup>

                            <VisualStateGroup x:Name=”CheckStates”>

                                <VisualState x:Name=”Checked”/>

                                <VisualState x:Name=”Unchecked”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Text” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource ApplicationSecondaryForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Indeterminate”/>

                            </VisualStateGroup>

                        </VisualStateManager.VisualStateGroups>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

    <!–

AppBarButtonStyle is used to style a Button for use in an App Bar. Content will be centered and should fit within

the 40-pixel radius glyph provided. 16-point Segoe UI Symbol is used for content text to simplify the use of glyphs

from that font. AutomationProperties.Name is used for the text below the glyph.

–>

    <Style x:Key=”AppBarButtonStyle” TargetType=”Button”>

        <Setter Property=”Foreground” Value=”{StaticResource AppBarItemForegroundThemeBrush}”/>

        <Setter Property=”VerticalAlignment” Value=”Stretch”/>

        <Setter Property=”FontFamily” Value=”Segoe UI Symbol”/>

        <Setter Property=”FontWeight” Value=”Normal”/>

        <Setter Property=”FontSize” Value=”20″/>

        <Setter Property=”AutomationProperties.ItemType” Value=”App Bar Button”/>

        <Setter Property=”Template”>

            <Setter.Value>

                <ControlTemplate TargetType=”Button”>

                    <Grid x:Name=”RootGrid” Width=”100″ Background=”Transparent”>

                        <StackPanel VerticalAlignment=”Top” Margin=”0,12,0,11″>

                            <Grid Width=”40″ Height=”40″ Margin=”0,0,0,5″ HorizontalAlignment=”Center”>

                                <TextBlock x:Name=”BackgroundGlyph” Text=”” FontFamily=”Segoe UI Symbol” FontSize=”53.333″ Margin=”-4,-19,0,0″ Foreground=”{StaticResource AppBarItemBackgroundThemeBrush}”/>

                                <TextBlock x:Name=”OutlineGlyph” Text=”” FontFamily=”Segoe UI Symbol” FontSize=”53.333″ Margin=”-4,-19,0,0″/>

                                <ContentPresenter x:Name=”Content” HorizontalAlignment=”Center” Margin=”-1,-1,0,0″ VerticalAlignment=”Center”/>

                            </Grid>

                            <TextBlock

x:Name=”TextLabel”

Text=”{TemplateBinding AutomationProperties.Name}”

Foreground=”{StaticResource AppBarItemForegroundThemeBrush}”

Margin=”0,0,2,0″

FontSize=”12″

TextAlignment=”Center”

Width=”88″

MaxHeight=”32″

TextTrimming=”WordEllipsis”

Style=”{StaticResource BasicTextStyle}”/>

                        </StackPanel>

                        <Rectangle

x:Name=”FocusVisualWhite”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualWhiteStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”1.5″/>

                        <Rectangle

x:Name=”FocusVisualBlack”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualBlackStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”0.5″/>

                        <VisualStateManager.VisualStateGroups>

                            <VisualStateGroup x:Name=”ApplicationViewStates”>

                                <VisualState x:Name=”FullScreenLandscape”/>

                                <VisualState x:Name=”Filled”/>

                                <VisualState x:Name=”FullScreenPortrait”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”TextLabel” Storyboard.TargetProperty=”Visibility”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”Collapsed”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”RootGrid” Storyboard.TargetProperty=”Width”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”60″/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Snapped”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”TextLabel” Storyboard.TargetProperty=”Visibility”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”Collapsed”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”RootGrid” Storyboard.TargetProperty=”Width”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”60″/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                            </VisualStateGroup>

                            <VisualStateGroup x:Name=”CommonStates”>

                                <VisualState x:Name=”Normal”/>

                                <VisualState x:Name=”PointerOver”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”BackgroundGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemPointerOverBackgroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Content” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemPointerOverForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Pressed”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”OutlineGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”BackgroundGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Content” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemPressedForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Disabled”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”OutlineGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemDisabledForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”Content” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemDisabledForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”TextLabel” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource AppBarItemDisabledForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                            </VisualStateGroup>

                            <VisualStateGroup x:Name=”FocusStates”>

                                <VisualState x:Name=”Focused”>

                                    <Storyboard>

                                        <DoubleAnimation

Storyboard.TargetName=”FocusVisualWhite”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                        <DoubleAnimation

Storyboard.TargetName=”FocusVisualBlack”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Unfocused” />

                                <VisualState x:Name=”PointerFocused” />

                            </VisualStateGroup>

                        </VisualStateManager.VisualStateGroups>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

    <!– Standard App Bar buttons –>

    <Style x:Key=”SkipBackAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”SkipBackAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Skip Back”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”SkipAheadAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”SkipAheadAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Skip Ahead”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”PlayAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”PlayAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Play”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”PauseAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”PauseAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Pause”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”EditAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”EditAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Edit”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”SaveAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”SaveAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Save”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”DeleteAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”DeleteAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Delete”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”DiscardAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”DiscardAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Discard”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”RemoveAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”RemoveAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Remove”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”AddAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”AddAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Add”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”NoAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”NoAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”No”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”YesAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”YesAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Yes”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”MoreAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”MoreAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”More”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”RedoAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”RedoAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Redo”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”UndoAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”UndoAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Undo”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”HomeAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”HomeAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Home”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”OutAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”OutAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Out”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”NextAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”NextAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Next”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”PreviousAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”PreviousAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Previous”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”FavoriteAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”FavoriteAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Favorite”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”PhotoAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”PhotoAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Photo”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”SettingsAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”SettingsAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Settings”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”VideoAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”VideoAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Video”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”RefreshAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”RefreshAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Refresh”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”DownloadAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”DownloadAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Download”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”MailAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”MailAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Mail”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”SearchAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”SearchAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Search”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”HelpAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”HelpAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Help”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”UploadAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”UploadAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Upload”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”PinAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”PinAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Pin”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <Style x:Key=”UnpinAppBarButtonStyle” TargetType=”Button” BasedOn=”{StaticResource AppBarButtonStyle}”>

        <Setter Property=”AutomationProperties.AutomationId” Value=”UnpinAppBarButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Unpin”/>

        <Setter Property=”Content” Value=””/>

    </Style>

    <!– Title area styles –>

    <Style x:Key=”PageHeaderTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource HeaderTextStyle}”>

        <Setter Property=”TextWrapping” Value=”NoWrap”/>

        <Setter Property=”VerticalAlignment” Value=”Bottom”/>

        <Setter Property=”Margin” Value=”0,0,30,40″/>

    </Style>

    <Style x:Key=”PageSubheaderTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource SubheaderTextStyle}”>

        <Setter Property=”TextWrapping” Value=”NoWrap”/>

        <Setter Property=”VerticalAlignment” Value=”Bottom”/>

        <Setter Property=”Margin” Value=”0,0,0,40″/>

    </Style>

    <Style x:Key=”SnappedPageHeaderTextStyle” TargetType=”TextBlock” BasedOn=”{StaticResource PageSubheaderTextStyle}”>

        <Setter Property=”Margin” Value=”0,0,18,40″/>

    </Style>

    <!–

BackButtonStyle is used to style a Button for use in the title area of a page. Margins appropriate for

the conventional page layout are included as part of the style.

–>

    <Style x:Key=”BackButtonStyle” TargetType=”Button”>

        <Setter Property=”MinWidth” Value=”0″/>

        <Setter Property=”Width” Value=”48″/>

        <Setter Property=”Height” Value=”48″/>

        <Setter Property=”Margin” Value=”36,0,36,36″/>

        <Setter Property=”VerticalAlignment” Value=”Bottom”/>

        <Setter Property=”FontFamily” Value=”Segoe UI Symbol”/>

        <Setter Property=”FontWeight” Value=”Normal”/>

        <Setter Property=”FontSize” Value=”56″/>

        <Setter Property=”AutomationProperties.AutomationId” Value=”BackButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Back”/>

        <Setter Property=”AutomationProperties.ItemType” Value=”Navigation Button”/>

        <Setter Property=”Template”>

            <Setter.Value>

                <ControlTemplate TargetType=”Button”>

                    <Grid x:Name=”RootGrid”>

                        <Grid Margin=”-1,-16,0,0″>

                            <TextBlock x:Name=”BackgroundGlyph” Text=”” Foreground=”{StaticResource BackButtonBackgroundThemeBrush}”/>

                            <TextBlock x:Name=”NormalGlyph” Text=”{StaticResource BackButtonGlyph}” Foreground=”{StaticResource BackButtonForegroundThemeBrush}”/>

                            <TextBlock x:Name=”ArrowGlyph” Text=”” Foreground=”{StaticResource BackButtonPressedForegroundThemeBrush}” Opacity=”0″/>

                        </Grid>

                        <Rectangle

x:Name=”FocusVisualWhite”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualWhiteStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”1.5″/>

                        <Rectangle

x:Name=”FocusVisualBlack”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualBlackStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”0.5″/>

                        <VisualStateManager.VisualStateGroups>

                            <VisualStateGroup x:Name=”CommonStates”>

                                <VisualState x:Name=”Normal” />

                                <VisualState x:Name=”PointerOver”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”BackgroundGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource BackButtonPointerOverBackgroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”NormalGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource BackButtonPointerOverForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Pressed”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”BackgroundGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource BackButtonForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <DoubleAnimation

Storyboard.TargetName=”ArrowGlyph”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                        <DoubleAnimation

Storyboard.TargetName=”NormalGlyph”

Storyboard.TargetProperty=”Opacity”

To=”0″

Duration=”0″/>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Disabled”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”RootGrid” Storyboard.TargetProperty=”Visibility”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”Collapsed”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                            </VisualStateGroup>

                            <VisualStateGroup x:Name=”FocusStates”>

                                <VisualState x:Name=”Focused”>

                                    <Storyboard>

                                        <DoubleAnimation

Storyboard.TargetName=”FocusVisualWhite”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                        <DoubleAnimation

Storyboard.TargetName=”FocusVisualBlack”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Unfocused” />

                                <VisualState x:Name=”PointerFocused” />

                            </VisualStateGroup>

                        </VisualStateManager.VisualStateGroups>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

    <!–

PortraitBackButtonStyle is used to style a Button for use in the title area of a portrait page. Margins appropriate

for the conventional page layout are included as part of the style.

–>

    <Style x:Key=”PortraitBackButtonStyle” TargetType=”Button” BasedOn=”{StaticResource BackButtonStyle}”>

        <Setter Property=”Margin” Value=”26,0,26,36″/>

    </Style>

    <!–

SnappedBackButtonStyle is used to style a Button for use in the title area of a snapped page. Margins appropriate

for the conventional page layout are included as part of the style.

The obvious duplication here is necessary as the glyphs used in snapped are not merely smaller versions of the same

glyph but are actually distinct.

–>

    <Style x:Key=”SnappedBackButtonStyle” TargetType=”Button”>

        <Setter Property=”MinWidth” Value=”0″/>

        <Setter Property=”Margin” Value=”20,0,0,0″/>

        <Setter Property=”VerticalAlignment” Value=”Bottom”/>

        <Setter Property=”FontFamily” Value=”Segoe UI Symbol”/>

        <Setter Property=”FontWeight” Value=”Normal”/>

        <Setter Property=”FontSize” Value=”26.66667″/>

        <Setter Property=”AutomationProperties.AutomationId” Value=”BackButton”/>

        <Setter Property=”AutomationProperties.Name” Value=”Back”/>

        <Setter Property=”AutomationProperties.ItemType” Value=”Navigation Button”/>

        <Setter Property=”Template”>

            <Setter.Value>

                <ControlTemplate TargetType=”Button”>

                    <Grid x:Name=”RootGrid” Width=”36″ Height=”36″ Margin=”-3,0,7,33″>

                        <Grid Margin=”-1,-1,0,0″>

                            <TextBlock x:Name=”BackgroundGlyph” Text=”” Foreground=”{StaticResource BackButtonBackgroundThemeBrush}”/>

                            <TextBlock x:Name=”NormalGlyph” Text=”{StaticResource BackButtonSnappedGlyph}” Foreground=”{StaticResource BackButtonForegroundThemeBrush}”/>

                            <TextBlock x:Name=”ArrowGlyph” Text=”” Foreground=”{StaticResource BackButtonPressedForegroundThemeBrush}” Opacity=”0″/>

                        </Grid>

                        <Rectangle

x:Name=”FocusVisualWhite”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualWhiteStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”1.5″/>

                        <Rectangle

x:Name=”FocusVisualBlack”

IsHitTestVisible=”False”

Stroke=”{StaticResource FocusVisualBlackStrokeThemeBrush}”

StrokeEndLineCap=”Square”

StrokeDashArray=”1,1″

Opacity=”0″

StrokeDashOffset=”0.5″/>

                        <VisualStateManager.VisualStateGroups>

                            <VisualStateGroup x:Name=”CommonStates”>

                                <VisualState x:Name=”Normal” />

                                <VisualState x:Name=”PointerOver”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”BackgroundGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource BackButtonPointerOverBackgroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”NormalGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource BackButtonPointerOverForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Pressed”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”BackgroundGlyph” Storyboard.TargetProperty=”Foreground”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”{StaticResource BackButtonForegroundThemeBrush}”/>

                                        </ObjectAnimationUsingKeyFrames>

                                        <DoubleAnimation

Storyboard.TargetName=”ArrowGlyph”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                        <DoubleAnimation

Storyboard.TargetName=”NormalGlyph”

Storyboard.TargetProperty=”Opacity”

To=”0″

Duration=”0″/>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Disabled”>

                                    <Storyboard>

                                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName=”RootGrid” Storyboard.TargetProperty=”Visibility”>

                                            <DiscreteObjectKeyFrame KeyTime=”0″ Value=”Collapsed”/>

                                        </ObjectAnimationUsingKeyFrames>

                                    </Storyboard>

                                </VisualState>

                            </VisualStateGroup>

                            <VisualStateGroup x:Name=”FocusStates”>

                                <VisualState x:Name=”Focused”>

                                    <Storyboard>

                                        <DoubleAnimation

Storyboard.TargetName=”FocusVisualWhite”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                        <DoubleAnimation

Storyboard.TargetName=”FocusVisualBlack”

Storyboard.TargetProperty=”Opacity”

To=”1″

Duration=”0″/>

                                    </Storyboard>

                                </VisualState>

                                <VisualState x:Name=”Unfocused” />

                                <VisualState x:Name=”PointerFocused” />

                            </VisualStateGroup>

                        </VisualStateManager.VisualStateGroups>

                    </Grid>

                </ControlTemplate>

            </Setter.Value>

        </Setter>

    </Style>

    <!– Item templates –>

    <!– Grid-appropriate 250 pixel square item template as seen in the GroupedItemsPage and ItemsPage –>

    <DataTemplate x:Key=”Standard250x250ItemTemplate”>

        <Grid HorizontalAlignment=”Left” Width=”250″ Height=”250″>

            <Border Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}”>

                <Image Source=”{Binding Image}” Stretch=”UniformToFill”/>

            </Border>

            <StackPanel VerticalAlignment=”Bottom” Background=”{StaticResource ListViewItemOverlayBackgroundThemeBrush}”>

                <TextBlock Text=”{Binding Title}” Foreground=”{StaticResource ListViewItemOverlayForegroundThemeBrush}” Style=”{StaticResource TitleTextStyle}” Height=”60″ Margin=”15,0,15,0″/>

                <TextBlock Text=”{Binding Subtitle}” Foreground=”{StaticResource ListViewItemOverlaySecondaryForegroundThemeBrush}” Style=”{StaticResource CaptionTextStyle}” TextWrapping=”NoWrap” Margin=”15,0,15,10″/>

            </StackPanel>

        </Grid>

    </DataTemplate>

    <!– Grid-appropriate 500 by 130 pixel item template as seen in the GroupDetailPage –>

    <DataTemplate x:Key=”Standard500x130ItemTemplate”>

        <Grid Height=”110″ Width=”480″ Margin=”10″>

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width=”Auto”/>

                <ColumnDefinition Width=”*”/>

            </Grid.ColumnDefinitions>

            <Border Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}” Width=”110″ Height=”110″>

                <Image Source=”{Binding Image}” Stretch=”UniformToFill”/>

            </Border>

            <StackPanel Grid.Column=”1″ VerticalAlignment=”Top” Margin=”10,0,0,0″>

                <TextBlock Text=”{Binding Title}” Style=”{StaticResource TitleTextStyle}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Subtitle}” Style=”{StaticResource CaptionTextStyle}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Description}” Style=”{StaticResource BodyTextStyle}” MaxHeight=”60″/>

            </StackPanel>

        </Grid>

    </DataTemplate>

    <!– List-appropriate 130 pixel high item template as seen in the SplitPage –>

    <DataTemplate x:Key=”Standard130ItemTemplate”>

        <Grid Height=”110″ Margin=”6″>

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width=”Auto”/>

                <ColumnDefinition Width=”*”/>

            </Grid.ColumnDefinitions>

            <Border Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}” Width=”110″ Height=”110″>

                <Image Source=”{Binding Image}” Stretch=”UniformToFill”/>

            </Border>

            <StackPanel Grid.Column=”1″ VerticalAlignment=”Top” Margin=”10,0,0,0″>

                <TextBlock Text=”{Binding Title}” Style=”{StaticResource TitleTextStyle}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Subtitle}” Style=”{StaticResource CaptionTextStyle}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Description}” Style=”{StaticResource BodyTextStyle}” MaxHeight=”60″/>

            </StackPanel>

        </Grid>

    </DataTemplate>

    <!–

List-appropriate 80 pixel high item template as seen in the SplitPage when Filled, and

the following pages when snapped: GroupedItemsPage, GroupDetailPage, and ItemsPage

–>

    <DataTemplate x:Key=”Standard80ItemTemplate”>

        <Grid Margin=”6″>

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width=”Auto”/>

                <ColumnDefinition Width=”*”/>

            </Grid.ColumnDefinitions>

            <Border Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}” Width=”60″ Height=”60″>

                <Image Source=”{Binding Image}” Stretch=”UniformToFill”/>

            </Border>

            <StackPanel Grid.Column=”1″ Margin=”10,0,0,0″>

                <TextBlock Text=”{Binding Title}” Style=”{StaticResource ItemTextStyle}” MaxHeight=”40″/>

                <TextBlock Text=”{Binding Subtitle}” Style=”{StaticResource CaptionTextStyle}” TextWrapping=”NoWrap”/>

            </StackPanel>

        </Grid>

    </DataTemplate>

    <!– Grid-appropriate 300 by 70 pixel item template as seen in the SearchResultsPage –>

    <DataTemplate x:Key=”StandardSmallIcon300x70ItemTemplate”>

        <Grid Width=”294″ Margin=”6″>

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width=”Auto”/>

                <ColumnDefinition Width=”*”/>

            </Grid.ColumnDefinitions>

            <Border Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}” Margin=”0,0,0,10″ Width=”40″ Height=”40″>

                <Image Source=”{Binding Image}” Stretch=”UniformToFill”/>

            </Border>

            <StackPanel Grid.Column=”1″ Margin=”10,-10,0,0″>

                <TextBlock Text=”{Binding Title}” Style=”{StaticResource BodyTextStyle}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Subtitle}” Style=”{StaticResource BodyTextStyle}” Foreground=”{StaticResource ApplicationSecondaryForegroundThemeBrush}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Description}” Style=”{StaticResource BodyTextStyle}” Foreground=”{StaticResource ApplicationSecondaryForegroundThemeBrush}” TextWrapping=”NoWrap”/>

            </StackPanel>

        </Grid>

    </DataTemplate>

    <!– List-appropriate 70 pixel high item template as seen in the SearchResultsPage when Snapped –>

    <DataTemplate x:Key=”StandardSmallIcon70ItemTemplate”>

        <Grid Margin=”6″>

            <Grid.ColumnDefinitions>

                <ColumnDefinition Width=”Auto”/>

                <ColumnDefinition Width=”*”/>

            </Grid.ColumnDefinitions>

            <Border Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}” Margin=”0,0,0,10″ Width=”40″ Height=”40″>

                <Image Source=”{Binding Image}” Stretch=”UniformToFill”/>

            </Border>

            <StackPanel Grid.Column=”1″ Margin=”10,-10,0,0″>

                <TextBlock Text=”{Binding Title}” Style=”{StaticResource BodyTextStyle}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Subtitle}” Style=”{StaticResource BodyTextStyle}” Foreground=”{StaticResource ApplicationSecondaryForegroundThemeBrush}” TextWrapping=”NoWrap”/>

                <TextBlock Text=”{Binding Description}” Style=”{StaticResource BodyTextStyle}” Foreground=”{StaticResource ApplicationSecondaryForegroundThemeBrush}” TextWrapping=”NoWrap”/>

            </StackPanel>

        </Grid>

    </DataTemplate>

    <!–

190×130 pixel item template for displaying file previews as seen in the FileOpenPickerPage

Includes an elaborate tooltip to display title and description text

–>

    <DataTemplate x:Key=”StandardFileWithTooltip190x130ItemTemplate”>

        <Grid>

            <Grid Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}”>

                <Image

Source=”{Binding Image}”

Width=”190″

Height=”130″

HorizontalAlignment=”Center”

VerticalAlignment=”Center”

Stretch=”Uniform”/>

            </Grid>

            <ToolTipService.Placement>Mouse</ToolTipService.Placement>

            <ToolTipService.ToolTip>

                <ToolTip>

                    <ToolTip.Style>

                        <Style TargetType=”ToolTip”>

                            <Setter Property=”BorderBrush” Value=”{StaticResource ToolTipBackgroundThemeBrush}” />

                            <Setter Property=”Padding” Value=”0″ />

                        </Style>

                    </ToolTip.Style>

                    <Grid Background=”{StaticResource ApplicationPageBackgroundThemeBrush}”>

                        <Grid.ColumnDefinitions>

                            <ColumnDefinition Width=”Auto”/>

                            <ColumnDefinition Width=”*”/>

                        </Grid.ColumnDefinitions>

                        <Grid Background=”{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}” Margin=”20″>

                            <Image

Source=”{Binding Image}”

Width=”160″

Height=”160″

HorizontalAlignment=”Center”

VerticalAlignment=”Center”

Stretch=”Uniform”/>

                        </Grid>

                        <StackPanel Width=”200″ Grid.Column=”1″ Margin=”0,20,20,20″>

                            <TextBlock Text=”{Binding Title}” TextWrapping=”NoWrap” Style=”{StaticResource BodyTextStyle}”/>

                            <TextBlock Text=”{Binding Description}” MaxHeight=”140″ Foreground=”{StaticResource ApplicationSecondaryForegroundThemeBrush}” Style=”{StaticResource BodyTextStyle}”/>

                        </StackPanel>

                    </Grid>

                </ToolTip>

            </ToolTipService.ToolTip>

        </Grid>

    </DataTemplate>

    <!– ScrollViewer styles –>

    <Style x:Key=”HorizontalScrollViewerStyle” TargetType=”ScrollViewer”>

        <Setter Property=”HorizontalScrollBarVisibility” Value=”Auto”/>

        <Setter Property=”VerticalScrollBarVisibility” Value=”Disabled”/>

        <Setter Property=”ScrollViewer.HorizontalScrollMode” Value=”Enabled” />

        <Setter Property=”ScrollViewer.VerticalScrollMode” Value=”Disabled” />

        <Setter Property=”ScrollViewer.ZoomMode” Value=”Disabled” />

    </Style>

    <Style x:Key=”VerticalScrollViewerStyle” TargetType=”ScrollViewer”>

        <Setter Property=”HorizontalScrollBarVisibility” Value=”Disabled”/>

        <Setter Property=”VerticalScrollBarVisibility” Value=”Auto”/>

        <Setter Property=”ScrollViewer.HorizontalScrollMode” Value=”Disabled” />

        <Setter Property=”ScrollViewer.VerticalScrollMode” Value=”Enabled” />

        <Setter Property=”ScrollViewer.ZoomMode” Value=”Disabled” />

    </Style>

    <!– Page layout roots typically use entrance animations and a theme-appropriate background color –>

    <Style x:Key=”LayoutRootStyle” TargetType=”Panel”>

        <Setter Property=”Background” Value=”{StaticResource ApplicationPageBackgroundThemeBrush}”/>

        <Setter Property=”ChildrenTransitions”>

            <Setter.Value>

                <TransitionCollection>

                    <EntranceThemeTransition/>

                </TransitionCollection>

            </Setter.Value>

        </Setter>

    </Style>

</ResourceDictionary>

4)Run the Application but you’ll find that error 5)Stop the Application and search in the application(The entire Solution not the current document) for ApplicationPageBackgroundBrush you’ll find a one with an error change the Background property to any Color 6)Run the Application and I’ll Run 

Ibraheem Osama Mohamed

@IbraheemOsamaMo

Advertisements

Written by Ibraheem Osama Mohamed

June 12, 2012 at 1:32 pm

10 Responses

Subscribe to comments with RSS.

  1. It’s working, Thanks!

    ruddyllee

    July 9, 2012 at 4:35 am

  2. You are Welcome any time 🙂

  3. it’s working for Me too 🙂 Thanks

    Ahmed Maher Pasha

    July 25, 2012 at 2:01 am

  4. … [Trackback]…

    […] Find More Informations here: ibraheemosama.wordpress.com/2012/06/12/the-type-or-namespace-name-applicationviewstatechangedeventargs-does-not-exist-in-the-namespace-windows-ui-viewmanagement/ […]…

    Homepage

    September 24, 2012 at 2:12 am

  5. … [Trackback]…

    […] Find More Informations here: ibraheemosama.wordpress.com/2012/06/12/the-type-or-namespace-name-applicationviewstatechangedeventargs-does-not-exist-in-the-namespace-windows-ui-viewmanagement/ […]…

  6. … [Trackback]…

    […] Informations on that Topic: ibraheemosama.wordpress.com/2012/06/12/the-type-or-namespace-name-applicationviewstatechangedeventargs-does-not-exist-in-the-namespace-windows-ui-viewmanagement/ […]…

    article source

    October 11, 2012 at 3:20 pm

  7. … [Trackback]…

    […] Read More: ibraheemosama.wordpress.com/2012/06/12/the-type-or-namespace-name-applicationviewstatechangedeventargs-does-not-exist-in-the-namespace-windows-ui-viewmanagement/ […]…

    home

    October 15, 2012 at 12:48 am

  8. After replacing both files with your code I am not able to do any click action to navigate to any Page,I have used Margin = ThicknessHelper.FromLengths(); in App which also gives error but after commented out ThicknessHelper error disappear but not able to click anything.Please help
    *Metro Style App with RTM version of visual studio

    Rahul

    October 17, 2012 at 5:11 pm

    • hi Rahul,
      What is the release of Windows 8 you are using right now ?? and what is the release of Windows 8 you create the project on ??
      And the version of Visual Studio too ? 🙂
      Thanks,

      Ibraheem Osama Mohamed

      October 19, 2012 at 12:32 pm

  9. … [Trackback]…

    […] Read More here: ibraheemosama.wordpress.com/2012/06/12/the-type-or-namespace-name-applicationviewstatechangedeventargs-does-not-exist-in-the-namespace-windows-ui-viewmanagement/ […]…

    Las Vegas nightclubs

    October 22, 2012 at 1:10 pm


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: