Updating project and item templates, including for Win8 RP

This commit is contained in:
Laurent Bugnion 2012-06-25 15:19:19 +02:00
Родитель 014de6b5dd
Коммит 5896c14253
82 изменённых файлов: 748 добавлений и 1746 удалений

Просмотреть файл

@ -9,7 +9,7 @@ namespace ProjectForTemplates.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace ProjectForTemplates.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace ProjectForTemplates.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace ProjectForTemplates.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace ProjectForTemplates.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace ProjectForTemplates.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace ProjectForTemplates.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace ProjectForTemplates.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace ProjectForTemplates.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace ProjectForTemplates.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -1,10 +1,11 @@
<Application x:Class="ProjectForTemplates.Win8.App"
<Application x:Class="ProjectForTemplates.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:vm="using:ProjectForTemplates.Win8.ViewModel">
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:ignore="http://www.ignore.com"
mc:Ignorable="d ignore"
xmlns:vm="using:ProjectForTemplates.ViewModel">
<Application.Resources>
<ResourceDictionary>
@ -13,7 +14,7 @@
d:IsDataSource="True" />
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Skins/MainSkin.xaml" />
<!--
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
@ -23,4 +24,4 @@
</ResourceDictionary>
</Application.Resources>
</Application>
</Application>

Просмотреть файл

@ -15,7 +15,7 @@ using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace ProjectForTemplates.Win8
namespace ProjectForTemplates
{
/// <summary>
/// Provides application-specific behavior to supplement the default Application class.
@ -28,8 +28,8 @@ namespace ProjectForTemplates.Win8
/// </summary>
public App()
{
this.InitializeComponent();
this.Suspending += OnSuspending;
InitializeComponent();
Suspending += OnSuspending;
}
/// <summary>
@ -40,6 +40,14 @@ namespace ProjectForTemplates.Win8
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
// Do not repeat app initialization when already running, just ensure that
// the window is active
if (args.PreviousExecutionState == ApplicationExecutionState.Running)
{
Window.Current.Activate();
return;
}
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
@ -47,7 +55,10 @@ namespace ProjectForTemplates.Win8
// Create a Frame to act navigation context and navigate to the first page
var rootFrame = new Frame();
rootFrame.Navigate(typeof(MainPage));
if (!rootFrame.Navigate(typeof(MainPage)))
{
throw new Exception("Failed to create initial page");
}
// Place the frame in the current Window and ensure that it is active
Window.Current.Content = rootFrame;
@ -63,9 +74,11 @@ namespace ProjectForTemplates.Win8
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
void OnSuspending(object sender, SuspendingEventArgs e)
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Просмотреть файл

@ -1,55 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Data;
namespace ProjectForTemplates.Win8.Common
{
/// <summary>
/// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public abstract class BindableBase : INotifyPropertyChanged
{
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.
/// </summary>
/// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to a property with both getter and setter.</param>
/// <param name="value">Desired value for the property.</param>
/// <param name="propertyName">Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers that
/// support CallerMemberName.</param>
/// <returns>True if the value was changed, false if the existing value matched the
/// desired value.</returns>
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
{
if (object.Equals(storage, value)) return false;
storage = value;
this.OnPropertyChanged(propertyName);
return true;
}
/// <summary>
/// Notifies listeners that a property value has changed.
/// </summary>
/// <param name="propertyName">Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers
/// that support <see cref="CallerMemberNameAttribute"/>.</param>
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

Просмотреть файл

@ -1,21 +0,0 @@
using System;
using Windows.UI.Xaml.Data;
namespace ProjectForTemplates.Win8.Common
{
/// <summary>
/// Value converter that translates true to false and vice versa.
/// </summary>
public sealed class BooleanNegationConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return !(value is bool && (bool)value);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return !(value is bool && (bool)value);
}
}
}

Просмотреть файл

@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
namespace ProjectForTemplates.Win8.Common
{
/// <summary>
/// Value converter that translates true to <see cref="Visibility.Visible"/> and false to
/// <see cref="Visibility.Collapsed"/>.
/// </summary>
public sealed class BooleanToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value is Visibility && (Visibility)value == Visibility.Visible;
}
}
}

Просмотреть файл

@ -1,365 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace ProjectForTemplates.Win8.Common
{
/// <summary>
/// Typical implementation of Page that provides several important conveniences:
/// application view state to visual state mapping, GoBack and GoHome event handlers, and
/// a default view model.
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public class LayoutAwarePage : Page
{
private List<Control> _layoutAwareControls;
private IObservableMap<String, Object> _defaultViewModel = new ObservableDictionary<String, Object>();
private bool _useFilledStateForNarrowWindow = false;
/// <summary>
/// Initializes a new instance of the <see cref="LayoutAwarePage"/> class.
/// </summary>
public LayoutAwarePage()
{
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) return;
// Map application view state to visual state for this page when it is part of the visual tree
this.Loaded += this.StartLayoutUpdates;
this.Unloaded += this.StopLayoutUpdates;
// Establish the default view model as the initial DataContext
this.DataContext = _defaultViewModel;
}
/// <summary>
/// Gets an implementation of <see cref="IObservableMap<String, Object>"/> set as the
/// page's default <see cref="DataContext"/>. This instance can be bound and surfaces
/// property change notifications making it suitable for use as a trivial view model.
/// </summary>
protected IObservableMap<String, Object> DefaultViewModel
{
get
{
return _defaultViewModel;
}
}
/// <summary>
/// Gets or sets a value indicating whether visual states can be a loose interpretation
/// of the actual application view state. This is often convenient when a page layout
/// is space constrained.
/// </summary>
/// <remarks>
/// The default value of false indicates that the visual state is identical to the view
/// state, meaning that Filled is only used when another application is snapped. When
/// set to true FullScreenLandscape is used to indicate that at least 1366 virtual
/// pixels of horizontal real estate are available - even if another application is
/// snapped - and Filled indicates a lesser width, even if no other application is
/// snapped. On a smaller display such as a 1024x768 panel this will result in the
/// visual state Filled whenever the device is in landscape orientation.
/// </remarks>
public bool UseFilledStateForNarrowWindow
{
get
{
return _useFilledStateForNarrowWindow;
}
set
{
_useFilledStateForNarrowWindow = value;
this.InvalidateVisualState();
}
}
/// <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>
protected virtual void 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 page's associated
/// <see cref="Frame"/> to go back one step on 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>
protected virtual void 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, typically on the <see cref="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="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"/>
public void StartLayoutUpdates(object sender, RoutedEventArgs e)
{
var control = sender as Control;
if (control == null) return;
if (this._layoutAwareControls == null)
{
// Start listening to view state changes when there are controls interested in updates
ApplicationView.GetForCurrentView().ViewStateChanged += this.ViewStateChanged;
Window.Current.SizeChanged += this.WindowSizeChanged;
this._layoutAwareControls = new List<Control>();
}
this._layoutAwareControls.Add(control);
// Set the initial visual state of the control
VisualStateManager.GoToState(control, DetermineVisualState(ApplicationView.Value), false);
}
private void ViewStateChanged(ApplicationView sender, ApplicationViewStateChangedEventArgs e)
{
this.InvalidateVisualState(e.ViewState);
}
private void WindowSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
if (this._useFilledStateForNarrowWindow) this.InvalidateVisualState();
}
/// <summary>
/// Invoked as an event handler, typically on the <see cref="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"/>
public void StopLayoutUpdates(object sender, RoutedEventArgs e)
{
var control = sender as Control;
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;
ApplicationView.GetForCurrentView().ViewStateChanged -= this.ViewStateChanged;
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"/>
protected virtual string DetermineVisualState(ApplicationViewState viewState)
{
if (this._useFilledStateForNarrowWindow &&
(viewState == ApplicationViewState.Filled ||
viewState == ApplicationViewState.FullScreenLandscape))
{
// Allow pages to request that the Filled state be used only for landscape layouts narrower
// than 1366 virtual pixels
var windowWidth = Window.Current.Bounds.Width;
viewState = windowWidth >= 1366 ? ApplicationViewState.FullScreenLandscape : ApplicationViewState.Filled;
}
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>
/// <param name="viewState">The desired view state, or null if the current view state
/// should be used.</param>
public void InvalidateVisualState(ApplicationViewState? viewState = null)
{
if (this._layoutAwareControls != null)
{
string visualState = DetermineVisualState(viewState == null ? ApplicationView.Value : viewState.Value);
foreach (var layoutAwareControl in this._layoutAwareControls)
{
VisualStateManager.GoToState(layoutAwareControl, visualState, false);
}
}
}
/// <summary>
/// Implementation of IObservableMap that supports reentrancy for use as a default view
/// model.
/// </summary>
private class ObservableDictionary<K, V> : IObservableMap<K, V>
{
private class ObservableDictionaryChangedEventArgs : IMapChangedEventArgs<K>
{
public ObservableDictionaryChangedEventArgs(CollectionChange change, K key)
{
this.CollectionChange = change;
this.Key = key;
}
public CollectionChange CollectionChange { get; private set; }
public K Key { get; private set; }
}
private Dictionary<K, V> _dictionary = new Dictionary<K, V>();
public event MapChangedEventHandler<K, V> MapChanged;
private void InvokeMapChanged(CollectionChange change, K key)
{
var eventHandler = MapChanged;
if (eventHandler != null)
{
eventHandler(this, new ObservableDictionaryChangedEventArgs(CollectionChange.ItemInserted, key));
}
}
public void Add(K key, V value)
{
this._dictionary.Add(key, value);
this.InvokeMapChanged(CollectionChange.ItemInserted, key);
}
public void Add(KeyValuePair<K, V> item)
{
this.Add(item.Key, item.Value);
}
public bool Remove(K key)
{
if (this._dictionary.Remove(key))
{
this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
return true;
}
return false;
}
public bool 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);
return true;
}
return false;
}
public V this[K key]
{
get
{
return this._dictionary[key];
}
set
{
this._dictionary[key] = value;
this.InvokeMapChanged(CollectionChange.ItemChanged, key);
}
}
public void Clear()
{
var priorKeys = this._dictionary.Keys.ToArray();
this._dictionary.Clear();
foreach (var key in priorKeys)
{
this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
}
}
public ICollection<K> Keys
{
get { return this._dictionary.Keys; }
}
public bool ContainsKey(K key)
{
return this._dictionary.ContainsKey(key);
}
public bool TryGetValue(K key, out V value)
{
return this._dictionary.TryGetValue(key, out value);
}
public ICollection<V> Values
{
get { return this._dictionary.Values; }
}
public bool Contains(KeyValuePair<K, V> item)
{
return this._dictionary.Contains(item);
}
public int Count
{
get { return this._dictionary.Count; }
}
public bool IsReadOnly
{
get { return false; }
}
public IEnumerator<KeyValuePair<K, V>> GetEnumerator()
{
return this._dictionary.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this._dictionary.GetEnumerator();
}
public void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex)
{
int arraySize = array.Length;
foreach (var pair in this._dictionary)
{
if (arrayIndex >= arraySize) break;
array[arrayIndex++] = pair;
}
}
}
}
}

Просмотреть файл

@ -1,7 +0,0 @@
The Common directory contains classes and 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
classes or styles are desired it is recommended that you copy the content under a new name and
modify your private copy.

Просмотреть файл

@ -1,210 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
namespace ProjectForTemplates.Win8.Common
{
/// <summary>
/// Wrapper for <see cref="RichTextBlock"/> that creates as many additional overflow
/// columns as needed to fit the available content.
/// </summary>
/// <example>
/// The following creates a collection of 400-pixel wide columns spaced 50 pixels apart
/// to contain arbitrary data-bound content:
/// <code>
/// <RichTextColumns>
/// <RichTextColumns.ColumnTemplate>
/// <DataTemplate>
/// <RichTextBlockOverflow Width="400" Margin="50,0,0,0"/>
/// </DataTemplate>
/// </RichTextColumns.ColumnTemplate>
///
/// <RichTextBlock Width="400">
/// <Paragraph>
/// <Run Text="{Binding Content}"/>
/// </Paragraph>
/// </RichTextBlock>
/// </RichTextColumns>
/// </code>
/// </example>
/// <remarks>Typically used in a horizontally scrolling region where an unbounded amount of
/// space allows for all needed columns to be created. When used in a vertically scrolling
/// space there will never be any additional columns.</remarks>
[Windows.UI.Xaml.Markup.ContentProperty(Name = "RichTextContent")]
public sealed class RichTextColumns : Panel
{
/// <summary>
/// Identifies the <see cref="RichTextContent"/> dependency property.
/// </summary>
public static readonly DependencyProperty RichTextContentProperty =
DependencyProperty.Register("RichTextContent", typeof(RichTextBlock),
typeof(RichTextColumns), new PropertyMetadata(null, ResetOverflowLayout));
/// <summary>
/// Identifies the <see cref="ColumnTemplate"/> dependency property.
/// </summary>
public static readonly DependencyProperty ColumnTemplateProperty =
DependencyProperty.Register("ColumnTemplate", typeof(DataTemplate),
typeof(RichTextColumns), new PropertyMetadata(null, ResetOverflowLayout));
/// <summary>
/// Initializes a new instance of the <see cref="RichTextColumns"/> class.
/// </summary>
public RichTextColumns()
{
this.HorizontalAlignment = HorizontalAlignment.Left;
}
/// <summary>
/// Gets or sets the initial rich text content to be used as the first column.
/// </summary>
public RichTextBlock RichTextContent
{
get { return (RichTextBlock)GetValue(RichTextContentProperty); }
set { SetValue(RichTextContentProperty, value); }
}
/// <summary>
/// Gets or sets the template used to create additional
/// <see cref="RichTextBlockOverflow"/> instances.
/// </summary>
public DataTemplate ColumnTemplate
{
get { return (DataTemplate)GetValue(ColumnTemplateProperty); }
set { SetValue(ColumnTemplateProperty, value); }
}
/// <summary>
/// Invoked when the content or overflow template is changed to recreate the column layout.
/// </summary>
/// <param name="d">Instance of <see cref="RichTextColumns"/> where the change
/// occurred.</param>
/// <param name="e">Event data describing the specific change.</param>
private static void ResetOverflowLayout(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// When dramatic changes occur, rebuild the column layout from scratch
var target = d as RichTextColumns;
if (target != null)
{
target._overflowColumns = null;
target.Children.Clear();
target.InvalidateMeasure();
}
}
/// <summary>
/// Lists overflow columns already created. Must maintain a 1:1 relationship with
/// instances in the <see cref="Chidren"/> collection following the initial RichTextBlock
/// child.
/// </summary>
private List<RichTextBlockOverflow> _overflowColumns = null;
/// <summary>
/// Determines whether additional overflow columns are needed and if existing columns can
/// be removed.
/// </summary>
/// <param name="availableSize">The size of the space available, used to constrain the
/// number of additional columns that can be created.</param>
/// <returns>The resulting size of the original content plus any extra columns.</returns>
protected override Size MeasureOverride(Size availableSize)
{
if (this.RichTextContent == null) return new Size(0, 0);
// Make sure the RichTextBlock is a child, using the lack of
// a list of additional columns as a sign that this hasn't been
// done yet
if (this._overflowColumns == null)
{
Children.Add(this.RichTextContent);
this._overflowColumns = new List<RichTextBlockOverflow>();
}
// Start by measuring the original RichTextBlock content
this.RichTextContent.Measure(availableSize);
var maxWidth = this.RichTextContent.DesiredSize.Width;
var maxHeight = this.RichTextContent.DesiredSize.Height;
var hasOverflow = this.RichTextContent.HasOverflowContent;
// Make sure there are enough overflow columns
int overflowIndex = 0;
while (hasOverflow && maxWidth < availableSize.Width && this.ColumnTemplate != null)
{
// Use existing overflow columns until we run out, then create
// more from the supplied template
RichTextBlockOverflow overflow;
if (this._overflowColumns.Count > overflowIndex)
{
overflow = this._overflowColumns[overflowIndex];
}
else
{
overflow = (RichTextBlockOverflow)this.ColumnTemplate.LoadContent();
this._overflowColumns.Add(overflow);
this.Children.Add(overflow);
if (overflowIndex == 0)
{
this.RichTextContent.OverflowContentTarget = overflow;
}
else
{
this._overflowColumns[overflowIndex - 1].OverflowContentTarget = overflow;
}
}
// Measure the new column and prepare to repeat as necessary
overflow.Measure(new Size(availableSize.Width - maxWidth, availableSize.Height));
maxWidth += overflow.DesiredSize.Width;
maxHeight = Math.Max(maxHeight, overflow.DesiredSize.Height);
hasOverflow = overflow.HasOverflowContent;
overflowIndex++;
}
// Disconnect extra columns from the overflow chain, remove them from our private list
// of columns, and remove them as children
if (this._overflowColumns.Count > overflowIndex)
{
if (overflowIndex == 0)
{
this.RichTextContent.OverflowContentTarget = null;
}
else
{
this._overflowColumns[overflowIndex - 1].OverflowContentTarget = null;
}
while (this._overflowColumns.Count > overflowIndex)
{
this._overflowColumns.RemoveAt(overflowIndex);
this.Children.RemoveAt(overflowIndex + 1);
}
}
// Report final determined size
return new Size(maxWidth, maxHeight);
}
/// <summary>
/// Arranges the original content and all extra columns.
/// </summary>
/// <param name="finalSize">Defines the size of the area the children must be arranged
/// within.</param>
/// <returns>The size of the area the children actually required.</returns>
protected override Size ArrangeOverride(Size finalSize)
{
double maxWidth = 0;
double maxHeight = 0;
foreach (var child in Children)
{
child.Arrange(new Rect(maxWidth, 0, child.DesiredSize.Width, finalSize.Height));
maxWidth += child.DesiredSize.Width;
maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
}
return new Size(maxWidth, maxHeight);
}
}
}

Просмотреть файл

@ -1,4 +1,14 @@
<ResourceDictionary
<!--
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"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@ -19,13 +29,14 @@
<!-- RichTextBlock styles -->
<Style x:Key="BasicRichTextStyle" TargetType="RichTextBlock">
<Setter Property="Foreground" Value="{StaticResource ApplicationTextBrush}"/>
<Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
<Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}"/>
<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}">
@ -48,13 +59,14 @@
<!-- TextBlock styles -->
<Style x:Key="BasicTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource ApplicationTextBrush}"/>
<Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
<Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}"/>
<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}">
@ -102,7 +114,7 @@
<Style x:Key="CaptionTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryTextBrush}"/>
<Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/>
</Style>
<!-- Button styles -->
@ -128,7 +140,7 @@
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -136,7 +148,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -148,21 +160,21 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationHoverTextBrush}"/>
<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 ApplicationPressedTextBrush}"/>
<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 ControlDisabledTextBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -190,6 +202,7 @@
<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">
@ -203,7 +216,7 @@
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -211,7 +224,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -223,21 +236,21 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationHoverTextBrush}"/>
<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 ApplicationPressedTextBrush}"/>
<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 ControlDisabledTextBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -256,7 +269,7 @@
<VisualState x:Name="Unchecked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationSecondaryTextBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -275,25 +288,26 @@
from that font. AutomationProperties.Name is used for the text below the glyph.
-->
<Style x:Key="AppBarButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource AppBarItemForegroundBrush}"/>
<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="21.333"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="AutomationProperties.ItemType" Value="App Bar Button"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Width="100" Background="Transparent">
<StackPanel VerticalAlignment="Top" Margin="0,14,0,13">
<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="&#xE0A8;" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0" Foreground="{StaticResource AppBarItemBackgroundBrush}"/>
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0A8;" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0" Foreground="{StaticResource AppBarItemBackgroundThemeBrush}"/>
<TextBlock x:Name="OutlineGlyph" Text="&#xE0A7;" 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"
@ -305,7 +319,7 @@
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -313,50 +327,72 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
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 AppBarItemHoverBackgroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPointerOverBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemHoverForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPointerOverForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="OutlineGlyph"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0"/>
<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 AppBarItemForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPressedForegroundBrush}"/>
<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 AppBarItemDisabledForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -533,13 +569,23 @@
<Setter Property="AutomationProperties.Name" Value="Upload"/>
<Setter Property="Content" Value="&#xE11C;"/>
</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="&#xE141;"/>
</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="&#xE196;"/>
</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,40,40"/>
<Setter Property="Margin" Value="0,0,30,40"/>
</Style>
<Style x:Key="PageSubheaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource SubheaderTextStyle}">
@ -573,14 +619,14 @@
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid">
<Grid Margin="-1,-16,0,0">
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0A8;" Foreground="{StaticResource BackButtonBackgroundBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonGlyph}" Foreground="{StaticResource BackButtonGlyphBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0A6;" Foreground="{StaticResource BackButtonPressedGlyphBrush}" Opacity="0"/>
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0A8;" Foreground="{StaticResource BackButtonBackgroundThemeBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonGlyph}" Foreground="{StaticResource BackButtonForegroundThemeBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0A6;" Foreground="{StaticResource BackButtonPressedForegroundThemeBrush}" Opacity="0"/>
</Grid>
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -588,7 +634,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -600,17 +646,17 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverBackgroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverGlyphBrush}"/>
<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 BackButtonGlyphBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation
Storyboard.TargetName="ArrowGlyph"
@ -687,14 +733,14 @@
<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="&#xE0D4;" Foreground="{StaticResource BackButtonBackgroundBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonSnappedGlyph}" Foreground="{StaticResource BackButtonGlyphBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0C4;" Foreground="{StaticResource BackButtonPressedGlyphBrush}" Opacity="0"/>
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0D4;" Foreground="{StaticResource BackButtonBackgroundThemeBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonSnappedGlyph}" Foreground="{StaticResource BackButtonForegroundThemeBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0C4;" Foreground="{StaticResource BackButtonPressedForegroundThemeBrush}" Opacity="0"/>
</Grid>
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -702,7 +748,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -714,17 +760,17 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverBackgroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverGlyphBrush}"/>
<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 BackButtonGlyphBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation
Storyboard.TargetName="ArrowGlyph"
@ -776,12 +822,12 @@
<!-- 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 ListViewItemPlaceholderRectBrush}">
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image Source="{Binding Image}" Stretch="UniformToFill"/>
</Border>
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundBrush}">
<TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayTextBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/>
<TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryTextBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
<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>
@ -793,7 +839,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Width="110" Height="110">
<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">
@ -811,7 +857,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Width="110" Height="110">
<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">
@ -832,7 +878,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Width="60" Height="60">
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="60" Height="60">
<Image Source="{Binding Image}" Stretch="UniformToFill"/>
</Border>
<StackPanel Grid.Column="1" Margin="10,0,0,0">
@ -844,17 +890,18 @@
<!-- Grid-appropriate 300 by 70 pixel item template as seen in the SearchResultsPage -->
<DataTemplate x:Key="StandardSmallIcon300x70ItemTemplate">
<Grid Width="300">
<Grid Width="294" Margin="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Margin="10,10,0,20" Width="40" Height="40">
<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,0,10,10">
<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 ApplicationSecondaryTextBrush}" Height="40"/>
<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>
@ -866,12 +913,13 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Margin="0,0,0,10" Width="40" Height="40">
<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 ApplicationSecondaryTextBrush}" Height="40"/>
<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>
@ -882,7 +930,7 @@
-->
<DataTemplate x:Key="StandardFileWithTooltip190x130ItemTemplate">
<Grid>
<Grid Background="{StaticResource ListViewItemPlaceholderRectBrush}">
<Grid Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image
Source="{Binding Image}"
Width="190"
@ -893,36 +941,39 @@
</Grid>
<ToolTipService.Placement>Mouse</ToolTipService.Placement>
<ToolTipService.ToolTip>
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ToolTip>
<ToolTip.Style>
<Style TargetType="ToolTip">
<Setter Property="BorderBrush" Value="{StaticResource ToolTipBackgroundThemeBrush}" />
<Setter Property="Padding" Value="0" />
</Style>
</ToolTip.Style>
<Grid Background="{StaticResource ListViewItemPlaceholderRectBrush}" 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 ApplicationSecondaryTextBrush}" Style="{StaticResource BodyTextStyle}"/>
</StackPanel>
</Grid>
<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>
<!-- Default to 10-pixel spacing between grid items (after accounting for 4-pixel insets for focus) -->
<Style TargetType="GridViewItem">
<Setter Property="Margin" Value="0,0,2,2" />
</Style>
<!-- ScrollViewer styles -->
<Style x:Key="HorizontalScrollViewerStyle" TargetType="ScrollViewer">
@ -940,4 +991,17 @@
<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>

Просмотреть файл

@ -1,7 +1,7 @@
using System;
using ProjectForTemplates.Win8.Model;
using ProjectForTemplates.Model;
namespace ProjectForTemplates.Win8.Design
namespace ProjectForTemplates.Design
{
public class DesignDataService : IDataService
{

Просмотреть файл

@ -1,9 +1,12 @@
<Page x:Class="ProjectForTemplates.Win8.MainPage"
<Page x:Class="ProjectForTemplates.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
xmlns:ignore="http://www.ignore.com"
mc:Ignorable="d ignore"
d:DesignHeight="768"
d:DesignWidth="1366"
DataContext="{Binding Main, Source={StaticResource Locator}}">
<Page.Resources>
@ -14,12 +17,13 @@
</ResourceDictionary>
</Page.Resources>
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<TextBlock FontSize="56"
Text="{Binding WelcomeTitle}"
VerticalAlignment="Top"
HorizontalAlignment="Left"
TextWrapping="Wrap" FontFamily="Segoe UI Light" Margin="120,49,0,0" />
FontFamily="Segoe UI Light"
Margin="120,49,0,0" />
</Grid>
</Page>

Просмотреть файл

@ -12,7 +12,7 @@ using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace ProjectForTemplates.Win8
namespace ProjectForTemplates
{
public sealed partial class MainPage : Page
{

Просмотреть файл

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ProjectForTemplates.Win8.Model
namespace ProjectForTemplates.Model
{
public class DataItem
{

Просмотреть файл

@ -1,6 +1,6 @@
using System;
namespace ProjectForTemplates.Win8.Model
namespace ProjectForTemplates.Model
{
public class DataService : IDataService
{

Просмотреть файл

@ -3,7 +3,7 @@ using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace ProjectForTemplates.Win8.Model
namespace ProjectForTemplates.Model
{
public interface IDataService
{

Просмотреть файл

@ -6,15 +6,15 @@
Version="1.0.0.0" />
<Properties>
<DisplayName>ProjectForTemplates.Win8</DisplayName>
<DisplayName>ProjectForTemplates</DisplayName>
<PublisherDisplayName>Laurent</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
<Description>ProjectForTemplates.Win8</Description>
<Description>$projectname$</Description>
</Properties>
<Prerequisites>
<OSMinVersion>6.2</OSMinVersion>
<OSMaxVersionTested>6.2</OSMaxVersionTested>
<OSMinVersion>6.2.0</OSMinVersion>
<OSMaxVersionTested>6.2.0</OSMaxVersionTested>
</Prerequisites>
<Resources>
@ -24,14 +24,14 @@
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
EntryPoint="ProjectForTemplates.Win8.App">
EntryPoint="ProjectForTemplates.App">
<VisualElements
DisplayName="ProjectForTemplates.Win8"
DisplayName="ProjectForTemplates"
Logo="Assets\Logo.png"
SmallLogo="Assets\SmallLogo.png"
Description="ProjectForTemplates.Win8"
Description="ProjectForTemplates"
ForegroundText="light"
BackgroundColor="#222222">
BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>

Просмотреть файл

@ -7,14 +7,12 @@
<ProjectGuid>{594B342F-41A1-4474-B0F6-82F87179FC6C}</ProjectGuid>
<OutputType>AppContainerExe</OutputType>
<AppDesignerFolder>Properties</AppDesignerFolder>
<RootNamespace>ProjectForTemplates.Win8</RootNamespace>
<RootNamespace>ProjectForTemplates</RootNamespace>
<AssemblyName>ProjectForTemplates.Win8</AssemblyName>
<DefaultLanguage>en-US</DefaultLanguage>
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>ProjectForTemplates.Win8_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>B5357944FE53032123ED1C350338DACCF21FC0F9</PackageCertificateThumbprint>
<ExpressionBlendVersion>5.0.30129.0</ExpressionBlendVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -44,7 +42,6 @@
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
@ -56,7 +53,6 @@
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
@ -68,7 +64,6 @@
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
@ -80,7 +75,6 @@
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
@ -92,7 +86,6 @@
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
@ -104,15 +97,12 @@
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<CodeAnalysisRuleSet>ExpressRules.ruleset</CodeAnalysisRuleSet>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<Compile Include="Common\BindableBase.cs" />
<Compile Include="Common\BooleanToVisibilityConverter.cs" />
<Compile Include="Common\BooleanNegationConverter.cs" />
<Compile Include="Common\LayoutAwarePage.cs" />
<Compile Include="Common\RichTextColumns.cs" />
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
@ -131,25 +121,13 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="Common\ReadMe.txt" />
<None Include="ProjectForTemplates.Win8_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Logo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\MVVM_Original_195x100.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\SmallLogo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\SplashScreen.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\StoreLogo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.png" />
<Content Include="Assets\StoreLogo.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
@ -171,16 +149,16 @@
</ItemGroup>
<ItemGroup>
<Reference Include="GalaSoft.MvvmLight.Extras.Win8">
<HintPath>C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Extras.Win8.dll</HintPath>
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Extras.Win8.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Win8">
<HintPath>C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Win8.dll</HintPath>
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Win8.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\Microsoft.Practices.ServiceLocation.dll</HintPath>
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' ">
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />

Просмотреть файл

@ -14,20 +14,6 @@ using System.Runtime.InteropServices;
[assembly: AssemblyTrademark("")]
[assembly: AssemblyCulture("")]
// Setting ComVisible to false makes the types in this assembly not visible
// to COM components. If you need to access a type in this assembly from
// COM, set the ComVisible attribute to true on that type.
[assembly: ComVisible(false)]
//In order to begin building localizable applications, set
//<UICulture>CultureYouAreCodingWith</UICulture> in your .csproj file
//inside a <PropertyGroup>. For example, if you are using US english
//in your source files, set the <UICulture> to en-US. Then uncomment
//the NeutralResourceLanguage attribute below. Update the "en-US" in
//the line below to match the UICulture setting in the project file.
//[assembly: NeutralResourcesLanguage("en-US", UltimateResourceFallbackLocation.Satellite)]
// Version information for an assembly consists of the following four values:
//
// Major Version
@ -40,3 +26,4 @@ using System.Runtime.InteropServices;
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.1")]
[assembly: AssemblyFileVersion("0.0.0.1")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,7 +1,7 @@
using GalaSoft.MvvmLight;
using ProjectForTemplates.Win8.Model;
using ProjectForTemplates.Model;
namespace ProjectForTemplates.Win8.ViewModel
namespace ProjectForTemplates.ViewModel
{
/// <summary>
/// This class contains properties that the main View can data bind to.
@ -9,7 +9,7 @@ namespace ProjectForTemplates.Win8.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -1,7 +1,7 @@
/*
In App.xaml:
<Application.Resources>
<vm:ViewModelLocatorTemplate xmlns:vm="clr-namespace:ProjectForTemplates.Win8.ViewModel"
<vm:ViewModelLocatorTemplate xmlns:vm="using:ProjectForTemplates.ViewModel"
x:Key="Locator" />
</Application.Resources>
@ -12,9 +12,9 @@
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
using Microsoft.Practices.ServiceLocation;
using ProjectForTemplates.Win8.Model;
using ProjectForTemplates.Model;
namespace ProjectForTemplates.Win8.ViewModel
namespace ProjectForTemplates.ViewModel
{
/// <summary>
/// This class contains static references to all the view models in the
@ -24,7 +24,7 @@ namespace ProjectForTemplates.Win8.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -8,7 +8,7 @@ namespace $rootnamespace$
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$ : ViewModelBase

Просмотреть файл

@ -23,7 +23,7 @@ namespace $rootnamespace$
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$

Просмотреть файл

@ -8,7 +8,7 @@ namespace $rootnamespace$
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$ : ViewModelBase

Просмотреть файл

@ -23,7 +23,7 @@ namespace $rootnamespace$
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$

Двоичные данные
Templates/CSharp/ItemTemplates/Win8/MvvmView.Win8/MvvmLight.ico Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 31 KiB

Двоичные данные
Templates/CSharp/ItemTemplates/Win8/MvvmView.Win8/MvvmLight.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 55 KiB

Просмотреть файл

@ -0,0 +1,25 @@
<VSTemplate Version="3.0.0"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"
Type="Item">
<TemplateData>
<Name>MvvmView (Win8)</Name>
<Description>A view used in a WinRT MVVM application (by GalaSoft Laurent Bugnion)</Description>
<Icon>MvvmLight.ico</Icon>
<PreviewImage>MvvmLight.png</PreviewImage>
<ProjectType>CSharp</ProjectType>
<TemplateGroupID>WinRT-Managed</TemplateGroupID>
<DefaultName>MvvmView.xaml</DefaultName>
<SortOrder>2</SortOrder>
<ShowByDefault>false</ShowByDefault>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<ProjectItem ItemType="Page"
SubType="Designer"
CustomTool="MSBuild:Compile"
TargetFileName="$fileinputname$.xaml"
ReplaceParameters="true">ViewTemplate.xaml</ProjectItem>
<ProjectItem TargetFileName="$fileinputname$.xaml.cs"
ReplaceParameters="true">ViewTemplate.xaml.cs</ProjectItem>
</TemplateContent>
</VSTemplate>

Просмотреть файл

@ -0,0 +1,18 @@
<Page x:Class="$rootnamespace$.$safeitemname$"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:ignore="http://www.ignore.com"
mc:Ignorable="d ignore"
d:DesignHeight="768"
d:DesignWidth="1366"
DataContext="{Binding Main, Source={StaticResource Locator}}">
<Page.Resources>
</Page.Resources>
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
</Grid>
</Page>

Просмотреть файл

@ -0,0 +1,33 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace $rootnamespace$
{
public sealed partial class $safeitemname$ : Page
{
public $safeitemname$()
{
this.InitializeComponent();
}
/// <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 is typically used to configure the page.</param>
protected override void OnNavigatedTo(NavigationEventArgs e)
{
}
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 31 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 55 KiB

Просмотреть файл

@ -0,0 +1,21 @@
<VSTemplate Version="3.0.0"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"
Type="Item">
<TemplateData>
<Name>MvvmViewModel (Win8)</Name>
<Description>A ViewModel for a WinRT MVVM application (by GalaSoft Laurent Bugnion)</Description>
<Icon>MvvmLight.ico</Icon>
<PreviewImage>MvvmLight.png</PreviewImage>
<ProjectType>CSharp</ProjectType>
<TemplateGroupID>WinRT-Managed</TemplateGroupID>
<ShowByDefault>false</ShowByDefault>
<DefaultName>MvvmViewModel.cs</DefaultName>
<SortOrder>1</SortOrder>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<ProjectItem SubType="Code"
TargetFileName="$fileinputname$.cs"
ReplaceParameters="true">ViewModelTemplate.cs</ProjectItem>
</TemplateContent>
</VSTemplate>

Просмотреть файл

@ -0,0 +1,23 @@
using GalaSoft.MvvmLight;
namespace $rootnamespace$
{
/// <summary>
/// This class contains properties that a View can data bind to.
/// <para>
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$ : ViewModelBase
{
/// <summary>
/// Initializes a new instance of the $safeitemname$ class.
/// </summary>
public $safeitemname$()
{
}
}
}

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 31 KiB

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 55 KiB

Просмотреть файл

@ -0,0 +1,21 @@
<VSTemplate Version="3.0.0"
xmlns="http://schemas.microsoft.com/developer/vstemplate/2005"
Type="Item">
<TemplateData>
<Name>MvvmViewModelLocator (Win8)</Name>
<Description>A Locator for ViewModels in a WinRT MVVM application (by GalaSoft Laurent Bugnion)</Description>
<Icon>MvvmLight.ico</Icon>
<PreviewImage>MvvmLight.png</PreviewImage>
<ProjectType>CSharp</ProjectType>
<TemplateGroupID>WinRT-Managed</TemplateGroupID>
<ShowByDefault>false</ShowByDefault>
<DefaultName>MvvmViewModelLocator.cs</DefaultName>
<SortOrder>3</SortOrder>
<NumberOfParentCategoriesToRollUp>2</NumberOfParentCategoriesToRollUp>
</TemplateData>
<TemplateContent>
<ProjectItem SubType="Code"
TargetFileName="$fileinputname$.cs"
ReplaceParameters="true">ViewModelLocatorTemplate.cs</ProjectItem>
</TemplateContent>
</VSTemplate>

Просмотреть файл

@ -0,0 +1,61 @@
/*
In App.xaml:
<Application.Resources>
<vm:$safeitemname$ xmlns:vm="using:$rootnamespace$"
x:Key="Locator" />
</Application.Resources>
In the View:
DataContext="{Binding Source={StaticResource Locator}, Path=ViewModelName}"
*/
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Ioc;
using Microsoft.Practices.ServiceLocation;
namespace $rootnamespace$
{
/// <summary>
/// This class contains static references to all the view models in the
/// application and provides an entry point for the bindings.
/// <para>
/// Use the <strong>mvvmlocatorproperty</strong> snippet to add ViewModels
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$
{
static $safeitemname$()
{
ServiceLocator.SetLocatorProvider(() => SimpleIoc.Default);
if (ViewModelBase.IsInDesignModeStatic)
{
// SimpleIoc.Default.Register<IDataService, Design.DesignDataService>();
}
else
{
// SimpleIoc.Default.Register<IDataService, DataService>();
}
SimpleIoc.Default.Register<MainViewModel>();
}
/// <summary>
/// Gets the Main property.
/// </summary>
[System.Diagnostics.CodeAnalysis.SuppressMessage("Microsoft.Performance",
"CA1822:MarkMembersAsStatic",
Justification = "This non-static member is needed for data binding purposes.")]
public MainViewModel Main
{
get
{
return ServiceLocator.Current.GetInstance<MainViewModel>();
}
}
}
}

Просмотреть файл

@ -8,7 +8,7 @@ namespace $rootnamespace$
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$ : ViewModelBase

Просмотреть файл

@ -23,7 +23,7 @@ namespace $rootnamespace$
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class $safeitemname$

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -3,7 +3,8 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
mc:Ignorable="d"
xmlns:ignore="http://www.ignore.com"
mc:Ignorable="d ignore"
xmlns:vm="using:$safeprojectname$.ViewModel">
<Application.Resources>
@ -18,7 +19,7 @@
Styles that define common aspects of the platform look and feel
Required by Visual Studio project and item templates
-->
<ResourceDictionary Source="Common/StandardStyles.xaml"/>
<ResourceDictionary Source="Common/StandardStyles.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>

Просмотреть файл

@ -1,10 +1,19 @@
using System;
using System.Threading.Tasks;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using GalaSoft.MvvmLight.Threading;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Activation;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace $safeprojectname$
{
@ -31,6 +40,14 @@ namespace $safeprojectname$
/// <param name="args">Details about the launch request and process.</param>
protected override void OnLaunched(LaunchActivatedEventArgs args)
{
// Do not repeat app initialization when already running, just ensure that
// the window is active
if (args.PreviousExecutionState == ApplicationExecutionState.Running)
{
Window.Current.Activate();
return;
}
if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
//TODO: Load state from previously suspended application
@ -38,13 +55,16 @@ namespace $safeprojectname$
// Create a Frame to act navigation context and navigate to the first page
var rootFrame = new Frame();
rootFrame.Navigate(typeof(MainPage));
if (!rootFrame.Navigate(typeof(MainPage)))
{
throw new Exception("Failed to create initial page");
}
// Place the frame in the current Window and ensure that it is active
Window.Current.Content = rootFrame;
Window.Current.Activate();
DispatcherHelper.Initialize();
DispatcherHelper.Initialize();
}
/// <summary>
@ -54,9 +74,11 @@ namespace $safeprojectname$
/// </summary>
/// <param name="sender">The source of the suspend request.</param>
/// <param name="e">Details about the suspend request.</param>
void OnSuspending(object sender, SuspendingEventArgs e)
private void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
deferral.Complete();
}
}
}

Просмотреть файл

@ -21,8 +21,9 @@ using System.Runtime.InteropServices;
// Build Number
// Revision
//
// You can specify all the values or you can default the Revision and Build Numbers
// You can specify all the values or you can default the Build and Revision Numbers
// by using the '*' as shown below:
[assembly: AssemblyVersion("1.0.0.0")]
[assembly: AssemblyFileVersion("1.0.0.0")]
// [assembly: AssemblyVersion("1.0.*")]
[assembly: AssemblyVersion("0.0.0.1")]
[assembly: AssemblyFileVersion("0.0.0.1")]
[assembly: ComVisible(false)]

Просмотреть файл

@ -1,55 +0,0 @@
using System;
using System.ComponentModel;
using System.Runtime.CompilerServices;
using Windows.UI.Xaml.Data;
namespace $safeprojectname$.Common
{
/// <summary>
/// Implementation of <see cref="INotifyPropertyChanged"/> to simplify models.
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public abstract class BindableBase : INotifyPropertyChanged
{
/// <summary>
/// Multicast event for property change notifications.
/// </summary>
public event PropertyChangedEventHandler PropertyChanged;
/// <summary>
/// Checks if a property already matches a desired value. Sets the property and
/// notifies listeners only when necessary.
/// </summary>
/// <typeparam name="T">Type of the property.</typeparam>
/// <param name="storage">Reference to a property with both getter and setter.</param>
/// <param name="value">Desired value for the property.</param>
/// <param name="propertyName">Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers that
/// support CallerMemberName.</param>
/// <returns>True if the value was changed, false if the existing value matched the
/// desired value.</returns>
protected bool SetProperty<T>(ref T storage, T value, [CallerMemberName] String propertyName = null)
{
if (object.Equals(storage, value)) return false;
storage = value;
this.OnPropertyChanged(propertyName);
return true;
}
/// <summary>
/// Notifies listeners that a property value has changed.
/// </summary>
/// <param name="propertyName">Name of the property used to notify listeners. This
/// value is optional and can be provided automatically when invoked from compilers
/// that support <see cref="CallerMemberNameAttribute"/>.</param>
protected void OnPropertyChanged([CallerMemberName] string propertyName = null)
{
var eventHandler = this.PropertyChanged;
if (eventHandler != null)
{
eventHandler(this, new PropertyChangedEventArgs(propertyName));
}
}
}
}

Просмотреть файл

@ -1,21 +0,0 @@
using System;
using Windows.UI.Xaml.Data;
namespace $safeprojectname$.Common
{
/// <summary>
/// Value converter that translates true to false and vice versa.
/// </summary>
public sealed class BooleanNegationConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return !(value is bool && (bool)value);
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return !(value is bool && (bool)value);
}
}
}

Просмотреть файл

@ -1,32 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Runtime.CompilerServices;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.Graphics.Display;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
namespace $safeprojectname$.Common
{
/// <summary>
/// Value converter that translates true to <see cref="Visibility.Visible"/> and false to
/// <see cref="Visibility.Collapsed"/>.
/// </summary>
public sealed class BooleanToVisibilityConverter : IValueConverter
{
public object Convert(object value, Type targetType, object parameter, string language)
{
return (value is bool && (bool)value) ? Visibility.Visible : Visibility.Collapsed;
}
public object ConvertBack(object value, Type targetType, object parameter, string language)
{
return value is Visibility && (Visibility)value == Visibility.Visible;
}
}
}

Просмотреть файл

@ -1,365 +0,0 @@
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.ViewManagement;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace $safeprojectname$.Common
{
/// <summary>
/// Typical implementation of Page that provides several important conveniences:
/// application view state to visual state mapping, GoBack and GoHome event handlers, and
/// a default view model.
/// </summary>
[Windows.Foundation.Metadata.WebHostHidden]
public class LayoutAwarePage : Page
{
private List<Control> _layoutAwareControls;
private IObservableMap<String, Object> _defaultViewModel = new ObservableDictionary<String, Object>();
private bool _useFilledStateForNarrowWindow = false;
/// <summary>
/// Initializes a new instance of the <see cref="LayoutAwarePage"/> class.
/// </summary>
public LayoutAwarePage()
{
if (Windows.ApplicationModel.DesignMode.DesignModeEnabled) return;
// Map application view state to visual state for this page when it is part of the visual tree
this.Loaded += this.StartLayoutUpdates;
this.Unloaded += this.StopLayoutUpdates;
// Establish the default view model as the initial DataContext
this.DataContext = _defaultViewModel;
}
/// <summary>
/// Gets an implementation of <see cref="IObservableMap<String, Object>"/> set as the
/// page's default <see cref="DataContext"/>. This instance can be bound and surfaces
/// property change notifications making it suitable for use as a trivial view model.
/// </summary>
protected IObservableMap<String, Object> DefaultViewModel
{
get
{
return _defaultViewModel;
}
}
/// <summary>
/// Gets or sets a value indicating whether visual states can be a loose interpretation
/// of the actual application view state. This is often convenient when a page layout
/// is space constrained.
/// </summary>
/// <remarks>
/// The default value of false indicates that the visual state is identical to the view
/// state, meaning that Filled is only used when another application is snapped. When
/// set to true FullScreenLandscape is used to indicate that at least 1366 virtual
/// pixels of horizontal real estate are available - even if another application is
/// snapped - and Filled indicates a lesser width, even if no other application is
/// snapped. On a smaller display such as a 1024x768 panel this will result in the
/// visual state Filled whenever the device is in landscape orientation.
/// </remarks>
public bool UseFilledStateForNarrowWindow
{
get
{
return _useFilledStateForNarrowWindow;
}
set
{
_useFilledStateForNarrowWindow = value;
this.InvalidateVisualState();
}
}
/// <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>
protected virtual void 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 page's associated
/// <see cref="Frame"/> to go back one step on 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>
protected virtual void 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, typically on the <see cref="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="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"/>
public void StartLayoutUpdates(object sender, RoutedEventArgs e)
{
var control = sender as Control;
if (control == null) return;
if (this._layoutAwareControls == null)
{
// Start listening to view state changes when there are controls interested in updates
ApplicationView.GetForCurrentView().ViewStateChanged += this.ViewStateChanged;
Window.Current.SizeChanged += this.WindowSizeChanged;
this._layoutAwareControls = new List<Control>();
}
this._layoutAwareControls.Add(control);
// Set the initial visual state of the control
VisualStateManager.GoToState(control, DetermineVisualState(ApplicationView.Value), false);
}
private void ViewStateChanged(ApplicationView sender, ApplicationViewStateChangedEventArgs e)
{
this.InvalidateVisualState(e.ViewState);
}
private void WindowSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
if (this._useFilledStateForNarrowWindow) this.InvalidateVisualState();
}
/// <summary>
/// Invoked as an event handler, typically on the <see cref="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"/>
public void StopLayoutUpdates(object sender, RoutedEventArgs e)
{
var control = sender as Control;
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;
ApplicationView.GetForCurrentView().ViewStateChanged -= this.ViewStateChanged;
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"/>
protected virtual string DetermineVisualState(ApplicationViewState viewState)
{
if (this._useFilledStateForNarrowWindow &&
(viewState == ApplicationViewState.Filled ||
viewState == ApplicationViewState.FullScreenLandscape))
{
// Allow pages to request that the Filled state be used only for landscape layouts narrower
// than 1366 virtual pixels
var windowWidth = Window.Current.Bounds.Width;
viewState = windowWidth >= 1366 ? ApplicationViewState.FullScreenLandscape : ApplicationViewState.Filled;
}
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>
/// <param name="viewState">The desired view state, or null if the current view state
/// should be used.</param>
public void InvalidateVisualState(ApplicationViewState? viewState = null)
{
if (this._layoutAwareControls != null)
{
string visualState = DetermineVisualState(viewState == null ? ApplicationView.Value : viewState.Value);
foreach (var layoutAwareControl in this._layoutAwareControls)
{
VisualStateManager.GoToState(layoutAwareControl, visualState, false);
}
}
}
/// <summary>
/// Implementation of IObservableMap that supports reentrancy for use as a default view
/// model.
/// </summary>
private class ObservableDictionary<K, V> : IObservableMap<K, V>
{
private class ObservableDictionaryChangedEventArgs : IMapChangedEventArgs<K>
{
public ObservableDictionaryChangedEventArgs(CollectionChange change, K key)
{
this.CollectionChange = change;
this.Key = key;
}
public CollectionChange CollectionChange { get; private set; }
public K Key { get; private set; }
}
private Dictionary<K, V> _dictionary = new Dictionary<K, V>();
public event MapChangedEventHandler<K, V> MapChanged;
private void InvokeMapChanged(CollectionChange change, K key)
{
var eventHandler = MapChanged;
if (eventHandler != null)
{
eventHandler(this, new ObservableDictionaryChangedEventArgs(CollectionChange.ItemInserted, key));
}
}
public void Add(K key, V value)
{
this._dictionary.Add(key, value);
this.InvokeMapChanged(CollectionChange.ItemInserted, key);
}
public void Add(KeyValuePair<K, V> item)
{
this.Add(item.Key, item.Value);
}
public bool Remove(K key)
{
if (this._dictionary.Remove(key))
{
this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
return true;
}
return false;
}
public bool 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);
return true;
}
return false;
}
public V this[K key]
{
get
{
return this._dictionary[key];
}
set
{
this._dictionary[key] = value;
this.InvokeMapChanged(CollectionChange.ItemChanged, key);
}
}
public void Clear()
{
var priorKeys = this._dictionary.Keys.ToArray();
this._dictionary.Clear();
foreach (var key in priorKeys)
{
this.InvokeMapChanged(CollectionChange.ItemRemoved, key);
}
}
public ICollection<K> Keys
{
get { return this._dictionary.Keys; }
}
public bool ContainsKey(K key)
{
return this._dictionary.ContainsKey(key);
}
public bool TryGetValue(K key, out V value)
{
return this._dictionary.TryGetValue(key, out value);
}
public ICollection<V> Values
{
get { return this._dictionary.Values; }
}
public bool Contains(KeyValuePair<K, V> item)
{
return this._dictionary.Contains(item);
}
public int Count
{
get { return this._dictionary.Count; }
}
public bool IsReadOnly
{
get { return false; }
}
public IEnumerator<KeyValuePair<K, V>> GetEnumerator()
{
return this._dictionary.GetEnumerator();
}
System.Collections.IEnumerator System.Collections.IEnumerable.GetEnumerator()
{
return this._dictionary.GetEnumerator();
}
public void CopyTo(KeyValuePair<K, V>[] array, int arrayIndex)
{
int arraySize = array.Length;
foreach (var pair in this._dictionary)
{
if (arrayIndex >= arraySize) break;
array[arrayIndex++] = pair;
}
}
}
}
}

Просмотреть файл

@ -8,6 +8,7 @@
d:DesignHeight="768"
d:DesignWidth="1366"
DataContext="{Binding Main, Source={StaticResource Locator}}">
<Page.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
@ -16,8 +17,7 @@
</ResourceDictionary>
</Page.Resources>
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<Grid Background="{StaticResource ApplicationPageBackgroundThemeBrush}">
<TextBlock FontSize="56"
Text="{Binding WelcomeTitle}"
VerticalAlignment="Top"
@ -26,5 +26,4 @@
Margin="120,49,0,0" />
</Grid>
</Page>
</Page>

Просмотреть файл

@ -1,11 +1,15 @@
using System;
using System.Collections.Generic;
using System.IO;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.Foundation.Collections;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Controls.Primitives;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Input;
using Windows.UI.Xaml.Media;
using Windows.UI.Xaml.Navigation;
namespace $safeprojectname$

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -13,8 +13,6 @@
<FileAlignment>512</FileAlignment>
<ProjectTypeGuids>{BC8A1FFA-BEE3-4634-8014-F334798102B3};{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}</ProjectTypeGuids>
<PackageCertificateKeyFile>MvvmLight.Win8_TemporaryKey.pfx</PackageCertificateKeyFile>
<PackageCertificateThumbprint>B5357944FE53032123ED1C350338DACCF21FC0F9</PackageCertificateThumbprint>
<ExpressionBlendVersion>5.0.30129.0</ExpressionBlendVersion>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<PlatformTarget>AnyCPU</PlatformTarget>
@ -22,7 +20,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE;WIN8</DefineConstants>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
@ -31,16 +29,80 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE;WIN8</DefineConstants>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|ARM'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\ARM\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|ARM'">
<OutputPath>bin\ARM\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>ARM</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x64\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x64'">
<OutputPath>bin\x64\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x64</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x86'">
<DebugSymbols>true</DebugSymbols>
<OutputPath>bin\x86\Debug\</OutputPath>
<DefineConstants>DEBUG;TRACE;NETFX_CORE</DefineConstants>
<NoWarn>;2008</NoWarn>
<DebugType>full</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Release|x86'">
<OutputPath>bin\x86\Release\</OutputPath>
<DefineConstants>TRACE;NETFX_CORE</DefineConstants>
<Optimize>true</Optimize>
<NoWarn>;2008</NoWarn>
<DebugType>pdbonly</DebugType>
<PlatformTarget>x86</PlatformTarget>
<UseVSHostingProcess>false</UseVSHostingProcess>
<ErrorReport>prompt</ErrorReport>
<Prefer32Bit>true</Prefer32Bit>
</PropertyGroup>
<ItemGroup>
<!-- A reference to the entire .Net Framework and Windows SDK are automatically included -->
</ItemGroup>
<ItemGroup>
<Compile Include="Common\BindableBase.cs" />
<Compile Include="Common\BooleanToVisibilityConverter.cs" />
<Compile Include="Common\BooleanNegationConverter.cs" />
<Compile Include="Common\LayoutAwarePage.cs" />
<Compile Include="Common\RichTextColumns.cs" />
<Compile Include="App.xaml.cs">
<DependentUpon>App.xaml</DependentUpon>
</Compile>
@ -59,22 +121,13 @@
<AppxManifest Include="Package.appxmanifest">
<SubType>Designer</SubType>
</AppxManifest>
<None Include="Common\ReadMe.txt" />
<None Include="MvvmLight.Win8_TemporaryKey.pfx" />
</ItemGroup>
<ItemGroup>
<Content Include="Assets\Logo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\SmallLogo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\SplashScreen.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\StoreLogo.png">
<CopyToOutputDirectory>PreserveNewest</CopyToOutputDirectory>
</Content>
<Content Include="Assets\Logo.png" />
<Content Include="Assets\SmallLogo.png" />
<Content Include="Assets\SplashScreen.png" />
<Content Include="Assets\StoreLogo.png" />
</ItemGroup>
<ItemGroup>
<ApplicationDefinition Include="App.xaml">
@ -96,16 +149,16 @@
</ItemGroup>
<ItemGroup>
<Reference Include="GalaSoft.MvvmLight.Extras.Win8">
<HintPath>C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Extras.Win8.dll</HintPath>
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Extras.Win8.dll</HintPath>
</Reference>
<Reference Include="GalaSoft.MvvmLight.Win8">
<HintPath>C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Win8.dll</HintPath>
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\GalaSoft.MvvmLight.Win8.dll</HintPath>
</Reference>
<Reference Include="Microsoft.Practices.ServiceLocation">
<HintPath>C:\Program Files (x86)\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\Microsoft.Practices.ServiceLocation.dll</HintPath>
<HintPath>C:\Program Files\Laurent Bugnion (GalaSoft)\Mvvm Light Toolkit\Binaries\Win8\Microsoft.Practices.ServiceLocation.dll</HintPath>
</Reference>
</ItemGroup>
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' ">
<PropertyGroup Condition=" '$(VisualStudioVersion)' == '' or '$(VisualStudioVersion)' &lt; '11.0' ">
<VisualStudioVersion>11.0</VisualStudioVersion>
</PropertyGroup>
<Import Project="$(MSBuildExtensionsPath)\Microsoft\WindowsXaml\v$(VisualStudioVersion)\Microsoft.Windows.UI.Xaml.CSharp.targets" />

Просмотреть файл

@ -58,18 +58,6 @@
TargetFileName="Package.appxmanifest">Package.appxmanifest</ProjectItem>
<ProjectItem ReplaceParameters="false"
TargetFileName="MvvmLight.Win8_TemporaryKey.pfx">MvvmLight.Win8_TemporaryKey.pfx</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="Common\BindableBase.cs">BindableBase.cs</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="Common\BooleanNegationConverter.cs">BooleanNegationConverter.cs</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="Common\BooleanToVisibilityConverter.cs">BooleanToVisibilityConverter.cs</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="Common\LayoutAwarePage.cs">LayoutAwarePage.cs</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="Common\ReadMe.txt">ReadMe.txt</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="Common\RichTextColumns.cs">RichTextColumns.cs</ProjectItem>
<ProjectItem ReplaceParameters="true"
TargetFileName="Common\StandardStyles.xaml">StandardStyles.xaml</ProjectItem>
</Project>

Просмотреть файл

@ -4,23 +4,23 @@
<Identity Name="$guid9$"
Publisher="CN=$username$"
Version="1.0.0.0" />
<Properties>
<DisplayName>$projectname$</DisplayName>
<PublisherDisplayName>$username$</PublisherDisplayName>
<Logo>Assets\StoreLogo.png</Logo>
<Description>$projectname$</Description>
</Properties>
<Prerequisites>
<OSMinVersion>6.2</OSMinVersion>
<OSMaxVersionTested>6.2</OSMaxVersionTested>
<OSMinVersion>6.2.0</OSMinVersion>
<OSMaxVersionTested>6.2.0</OSMaxVersionTested>
</Prerequisites>
<Resources>
<Resource Language="en-us"/>
<Resource Language="x-generate"/>
</Resources>
<Applications>
<Application Id="App"
Executable="$targetnametoken$.exe"
@ -31,7 +31,8 @@
SmallLogo="Assets\SmallLogo.png"
Description="$projectname$"
ForegroundText="light"
BackgroundColor="#222222">
BackgroundColor="#464646">
<DefaultTile ShowName="allLogos" />
<SplashScreen Image="Assets\SplashScreen.png" />
</VisualElements>
</Application>

Просмотреть файл

@ -1,7 +0,0 @@
The Common directory contains classes and 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
classes or styles are desired it is recommended that you copy the content under a new name and
modify your private copy.

Просмотреть файл

@ -1,210 +0,0 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Threading.Tasks;
using Windows.Foundation;
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
using Windows.UI.Xaml.Data;
using Windows.UI.Xaml.Documents;
namespace $safeprojectname$.Common
{
/// <summary>
/// Wrapper for <see cref="RichTextBlock"/> that creates as many additional overflow
/// columns as needed to fit the available content.
/// </summary>
/// <example>
/// The following creates a collection of 400-pixel wide columns spaced 50 pixels apart
/// to contain arbitrary data-bound content:
/// <code>
/// <RichTextColumns>
/// <RichTextColumns.ColumnTemplate>
/// <DataTemplate>
/// <RichTextBlockOverflow Width="400" Margin="50,0,0,0"/>
/// </DataTemplate>
/// </RichTextColumns.ColumnTemplate>
///
/// <RichTextBlock Width="400">
/// <Paragraph>
/// <Run Text="{Binding Content}"/>
/// </Paragraph>
/// </RichTextBlock>
/// </RichTextColumns>
/// </code>
/// </example>
/// <remarks>Typically used in a horizontally scrolling region where an unbounded amount of
/// space allows for all needed columns to be created. When used in a vertically scrolling
/// space there will never be any additional columns.</remarks>
[Windows.UI.Xaml.Markup.ContentProperty(Name = "RichTextContent")]
public sealed class RichTextColumns : Panel
{
/// <summary>
/// Identifies the <see cref="RichTextContent"/> dependency property.
/// </summary>
public static readonly DependencyProperty RichTextContentProperty =
DependencyProperty.Register("RichTextContent", typeof(RichTextBlock),
typeof(RichTextColumns), new PropertyMetadata(null, ResetOverflowLayout));
/// <summary>
/// Identifies the <see cref="ColumnTemplate"/> dependency property.
/// </summary>
public static readonly DependencyProperty ColumnTemplateProperty =
DependencyProperty.Register("ColumnTemplate", typeof(DataTemplate),
typeof(RichTextColumns), new PropertyMetadata(null, ResetOverflowLayout));
/// <summary>
/// Initializes a new instance of the <see cref="RichTextColumns"/> class.
/// </summary>
public RichTextColumns()
{
this.HorizontalAlignment = HorizontalAlignment.Left;
}
/// <summary>
/// Gets or sets the initial rich text content to be used as the first column.
/// </summary>
public RichTextBlock RichTextContent
{
get { return (RichTextBlock)GetValue(RichTextContentProperty); }
set { SetValue(RichTextContentProperty, value); }
}
/// <summary>
/// Gets or sets the template used to create additional
/// <see cref="RichTextBlockOverflow"/> instances.
/// </summary>
public DataTemplate ColumnTemplate
{
get { return (DataTemplate)GetValue(ColumnTemplateProperty); }
set { SetValue(ColumnTemplateProperty, value); }
}
/// <summary>
/// Invoked when the content or overflow template is changed to recreate the column layout.
/// </summary>
/// <param name="d">Instance of <see cref="RichTextColumns"/> where the change
/// occurred.</param>
/// <param name="e">Event data describing the specific change.</param>
private static void ResetOverflowLayout(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
// When dramatic changes occur, rebuild the column layout from scratch
var target = d as RichTextColumns;
if (target != null)
{
target._overflowColumns = null;
target.Children.Clear();
target.InvalidateMeasure();
}
}
/// <summary>
/// Lists overflow columns already created. Must maintain a 1:1 relationship with
/// instances in the <see cref="Chidren"/> collection following the initial RichTextBlock
/// child.
/// </summary>
private List<RichTextBlockOverflow> _overflowColumns = null;
/// <summary>
/// Determines whether additional overflow columns are needed and if existing columns can
/// be removed.
/// </summary>
/// <param name="availableSize">The size of the space available, used to constrain the
/// number of additional columns that can be created.</param>
/// <returns>The resulting size of the original content plus any extra columns.</returns>
protected override Size MeasureOverride(Size availableSize)
{
if (this.RichTextContent == null) return new Size(0, 0);
// Make sure the RichTextBlock is a child, using the lack of
// a list of additional columns as a sign that this hasn't been
// done yet
if (this._overflowColumns == null)
{
Children.Add(this.RichTextContent);
this._overflowColumns = new List<RichTextBlockOverflow>();
}
// Start by measuring the original RichTextBlock content
this.RichTextContent.Measure(availableSize);
var maxWidth = this.RichTextContent.DesiredSize.Width;
var maxHeight = this.RichTextContent.DesiredSize.Height;
var hasOverflow = this.RichTextContent.HasOverflowContent;
// Make sure there are enough overflow columns
int overflowIndex = 0;
while (hasOverflow && maxWidth < availableSize.Width && this.ColumnTemplate != null)
{
// Use existing overflow columns until we run out, then create
// more from the supplied template
RichTextBlockOverflow overflow;
if (this._overflowColumns.Count > overflowIndex)
{
overflow = this._overflowColumns[overflowIndex];
}
else
{
overflow = (RichTextBlockOverflow)this.ColumnTemplate.LoadContent();
this._overflowColumns.Add(overflow);
this.Children.Add(overflow);
if (overflowIndex == 0)
{
this.RichTextContent.OverflowContentTarget = overflow;
}
else
{
this._overflowColumns[overflowIndex - 1].OverflowContentTarget = overflow;
}
}
// Measure the new column and prepare to repeat as necessary
overflow.Measure(new Size(availableSize.Width - maxWidth, availableSize.Height));
maxWidth += overflow.DesiredSize.Width;
maxHeight = Math.Max(maxHeight, overflow.DesiredSize.Height);
hasOverflow = overflow.HasOverflowContent;
overflowIndex++;
}
// Disconnect extra columns from the overflow chain, remove them from our private list
// of columns, and remove them as children
if (this._overflowColumns.Count > overflowIndex)
{
if (overflowIndex == 0)
{
this.RichTextContent.OverflowContentTarget = null;
}
else
{
this._overflowColumns[overflowIndex - 1].OverflowContentTarget = null;
}
while (this._overflowColumns.Count > overflowIndex)
{
this._overflowColumns.RemoveAt(overflowIndex);
this.Children.RemoveAt(overflowIndex + 1);
}
}
// Report final determined size
return new Size(maxWidth, maxHeight);
}
/// <summary>
/// Arranges the original content and all extra columns.
/// </summary>
/// <param name="finalSize">Defines the size of the area the children must be arranged
/// within.</param>
/// <returns>The size of the area the children actually required.</returns>
protected override Size ArrangeOverride(Size finalSize)
{
double maxWidth = 0;
double maxHeight = 0;
foreach (var child in Children)
{
child.Arrange(new Rect(maxWidth, 0, child.DesiredSize.Width, finalSize.Height));
maxWidth += child.DesiredSize.Width;
maxHeight = Math.Max(maxHeight, child.DesiredSize.Height);
}
return new Size(maxWidth, maxHeight);
}
}
}

Просмотреть файл

@ -1,4 +1,14 @@
<ResourceDictionary
<!--
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"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
@ -19,13 +29,14 @@
<!-- RichTextBlock styles -->
<Style x:Key="BasicRichTextStyle" TargetType="RichTextBlock">
<Setter Property="Foreground" Value="{StaticResource ApplicationTextBrush}"/>
<Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
<Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}"/>
<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}">
@ -48,13 +59,14 @@
<!-- TextBlock styles -->
<Style x:Key="BasicTextStyle" TargetType="TextBlock">
<Setter Property="Foreground" Value="{StaticResource ApplicationTextBrush}"/>
<Setter Property="FontSize" Value="{StaticResource ContentFontSize}"/>
<Setter Property="FontFamily" Value="{StaticResource ContentFontFamily}"/>
<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}">
@ -102,7 +114,7 @@
<Style x:Key="CaptionTextStyle" TargetType="TextBlock" BasedOn="{StaticResource BaselineTextStyle}">
<Setter Property="FontSize" Value="12"/>
<Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryTextBrush}"/>
<Setter Property="Foreground" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/>
</Style>
<!-- Button styles -->
@ -128,7 +140,7 @@
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -136,7 +148,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -148,21 +160,21 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationHoverTextBrush}"/>
<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 ApplicationPressedTextBrush}"/>
<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 ControlDisabledTextBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -190,6 +202,7 @@
<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">
@ -203,7 +216,7 @@
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -211,7 +224,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -223,21 +236,21 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationHoverTextBrush}"/>
<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 ApplicationPressedTextBrush}"/>
<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 ControlDisabledTextBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ButtonDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -256,7 +269,7 @@
<VisualState x:Name="Unchecked">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Text" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationSecondaryTextBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource ApplicationSecondaryForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -275,25 +288,26 @@
from that font. AutomationProperties.Name is used for the text below the glyph.
-->
<Style x:Key="AppBarButtonStyle" TargetType="Button">
<Setter Property="Foreground" Value="{StaticResource AppBarItemForegroundBrush}"/>
<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="21.333"/>
<Setter Property="FontSize" Value="20"/>
<Setter Property="AutomationProperties.ItemType" Value="App Bar Button"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Grid Width="100" Background="Transparent">
<StackPanel VerticalAlignment="Top" Margin="0,14,0,13">
<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="&#xE0A8;" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0" Foreground="{StaticResource AppBarItemBackgroundBrush}"/>
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0A8;" FontFamily="Segoe UI Symbol" FontSize="53.333" Margin="-4,-19,0,0" Foreground="{StaticResource AppBarItemBackgroundThemeBrush}"/>
<TextBlock x:Name="OutlineGlyph" Text="&#xE0A7;" 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"
@ -305,7 +319,7 @@
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -313,50 +327,72 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
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 AppBarItemHoverBackgroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPointerOverBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemHoverForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPointerOverForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
<VisualState x:Name="Pressed">
<Storyboard>
<DoubleAnimation
Storyboard.TargetName="OutlineGlyph"
Storyboard.TargetProperty="Opacity"
To="0"
Duration="0"/>
<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 AppBarItemForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemPressedForegroundBrush}"/>
<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 AppBarItemDisabledForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="Content" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="TextLabel" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource AppBarItemDisabledForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
</Storyboard>
</VisualState>
@ -533,13 +569,23 @@
<Setter Property="AutomationProperties.Name" Value="Upload"/>
<Setter Property="Content" Value="&#xE11C;"/>
</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="&#xE141;"/>
</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="&#xE196;"/>
</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,40,40"/>
<Setter Property="Margin" Value="0,0,30,40"/>
</Style>
<Style x:Key="PageSubheaderTextStyle" TargetType="TextBlock" BasedOn="{StaticResource SubheaderTextStyle}">
@ -573,14 +619,14 @@
<ControlTemplate TargetType="Button">
<Grid x:Name="RootGrid">
<Grid Margin="-1,-16,0,0">
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0A8;" Foreground="{StaticResource BackButtonBackgroundBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonGlyph}" Foreground="{StaticResource BackButtonGlyphBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0A6;" Foreground="{StaticResource BackButtonPressedGlyphBrush}" Opacity="0"/>
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0A8;" Foreground="{StaticResource BackButtonBackgroundThemeBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonGlyph}" Foreground="{StaticResource BackButtonForegroundThemeBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0A6;" Foreground="{StaticResource BackButtonPressedForegroundThemeBrush}" Opacity="0"/>
</Grid>
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -588,7 +634,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -600,17 +646,17 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverBackgroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverGlyphBrush}"/>
<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 BackButtonGlyphBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation
Storyboard.TargetName="ArrowGlyph"
@ -687,14 +733,14 @@
<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="&#xE0D4;" Foreground="{StaticResource BackButtonBackgroundBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonSnappedGlyph}" Foreground="{StaticResource BackButtonGlyphBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0C4;" Foreground="{StaticResource BackButtonPressedGlyphBrush}" Opacity="0"/>
<TextBlock x:Name="BackgroundGlyph" Text="&#xE0D4;" Foreground="{StaticResource BackButtonBackgroundThemeBrush}"/>
<TextBlock x:Name="NormalGlyph" Text="{StaticResource BackButtonSnappedGlyph}" Foreground="{StaticResource BackButtonForegroundThemeBrush}"/>
<TextBlock x:Name="ArrowGlyph" Text="&#xE0C4;" Foreground="{StaticResource BackButtonPressedForegroundThemeBrush}" Opacity="0"/>
</Grid>
<Rectangle
x:Name="FocusVisualWhite"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualWhiteStrokeBrush}"
Stroke="{StaticResource FocusVisualWhiteStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -702,7 +748,7 @@
<Rectangle
x:Name="FocusVisualBlack"
IsHitTestVisible="False"
Stroke="{StaticResource FocusVisualBlackStrokeBrush}"
Stroke="{StaticResource FocusVisualBlackStrokeThemeBrush}"
StrokeEndLineCap="Square"
StrokeDashArray="1,1"
Opacity="0"
@ -714,17 +760,17 @@
<VisualState x:Name="PointerOver">
<Storyboard>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="BackgroundGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverBackgroundBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonPointerOverBackgroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<ObjectAnimationUsingKeyFrames Storyboard.TargetName="NormalGlyph" Storyboard.TargetProperty="Foreground">
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonHoverGlyphBrush}"/>
<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 BackButtonGlyphBrush}"/>
<DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource BackButtonForegroundThemeBrush}"/>
</ObjectAnimationUsingKeyFrames>
<DoubleAnimation
Storyboard.TargetName="ArrowGlyph"
@ -776,12 +822,12 @@
<!-- 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 ListViewItemPlaceholderRectBrush}">
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image Source="{Binding Image}" Stretch="UniformToFill"/>
</Border>
<StackPanel VerticalAlignment="Bottom" Background="{StaticResource ListViewItemOverlayBackgroundBrush}">
<TextBlock Text="{Binding Title}" Foreground="{StaticResource ListViewItemOverlayTextBrush}" Style="{StaticResource TitleTextStyle}" Height="60" Margin="15,0,15,0"/>
<TextBlock Text="{Binding Subtitle}" Foreground="{StaticResource ListViewItemOverlaySecondaryTextBrush}" Style="{StaticResource CaptionTextStyle}" TextWrapping="NoWrap" Margin="15,0,15,10"/>
<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>
@ -793,7 +839,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Width="110" Height="110">
<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">
@ -811,7 +857,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Width="110" Height="110">
<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">
@ -832,7 +878,7 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Width="60" Height="60">
<Border Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}" Width="60" Height="60">
<Image Source="{Binding Image}" Stretch="UniformToFill"/>
</Border>
<StackPanel Grid.Column="1" Margin="10,0,0,0">
@ -844,17 +890,18 @@
<!-- Grid-appropriate 300 by 70 pixel item template as seen in the SearchResultsPage -->
<DataTemplate x:Key="StandardSmallIcon300x70ItemTemplate">
<Grid Width="300">
<Grid Width="294" Margin="6">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Margin="10,10,0,20" Width="40" Height="40">
<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,0,10,10">
<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 ApplicationSecondaryTextBrush}" Height="40"/>
<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>
@ -866,12 +913,13 @@
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<Border Background="{StaticResource ListViewItemPlaceholderRectBrush}" Margin="0,0,0,10" Width="40" Height="40">
<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 ApplicationSecondaryTextBrush}" Height="40"/>
<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>
@ -882,7 +930,7 @@
-->
<DataTemplate x:Key="StandardFileWithTooltip190x130ItemTemplate">
<Grid>
<Grid Background="{StaticResource ListViewItemPlaceholderRectBrush}">
<Grid Background="{StaticResource ListViewItemPlaceholderBackgroundThemeBrush}">
<Image
Source="{Binding Image}"
Width="190"
@ -893,36 +941,39 @@
</Grid>
<ToolTipService.Placement>Mouse</ToolTipService.Placement>
<ToolTipService.ToolTip>
<Grid Background="{StaticResource ApplicationPageBackgroundBrush}">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="*"/>
</Grid.ColumnDefinitions>
<ToolTip>
<ToolTip.Style>
<Style TargetType="ToolTip">
<Setter Property="BorderBrush" Value="{StaticResource ToolTipBackgroundThemeBrush}" />
<Setter Property="Padding" Value="0" />
</Style>
</ToolTip.Style>
<Grid Background="{StaticResource ListViewItemPlaceholderRectBrush}" 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 ApplicationSecondaryTextBrush}" Style="{StaticResource BodyTextStyle}"/>
</StackPanel>
</Grid>
<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>
<!-- Default to 10-pixel spacing between grid items (after accounting for 4-pixel insets for focus) -->
<Style TargetType="GridViewItem">
<Setter Property="Margin" Value="0,0,2,2" />
</Style>
<!-- ScrollViewer styles -->
<Style x:Key="HorizontalScrollViewerStyle" TargetType="ScrollViewer">
@ -940,4 +991,17 @@
<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>

Двоичный файл не отображается.

До

Ширина:  |  Высота:  |  Размер: 2.9 KiB

После

Ширина:  |  Высота:  |  Размер: 2.5 KiB

Просмотреть файл

@ -1,7 +1,7 @@
/*
In App.xaml:
<Application.Resources>
<vm:ViewModelLocatorTemplate xmlns:vm="clr-namespace:$safeprojectname$.ViewModel"
<vm:ViewModelLocatorTemplate xmlns:vm="using:ProjectForTemplates.ViewModel"
x:Key="Locator" />
</Application.Resources>
@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator

Просмотреть файл

@ -9,7 +9,7 @@ namespace $safeprojectname$.ViewModel
/// Use the <strong>mvvminpc</strong> snippet to add bindable properties to this ViewModel.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class MainViewModel : ViewModelBase

Просмотреть файл

@ -24,7 +24,7 @@ namespace $safeprojectname$.ViewModel
/// to this locator.
/// </para>
/// <para>
/// See http://www.galasoft.ch/mvvm/getstarted
/// See http://www.galasoft.ch/mvvm
/// </para>
/// </summary>
public class ViewModelLocator