本文整理汇总了C#中ApplicationViewState类的典型用法代码示例。如果您正苦于以下问题:C# ApplicationViewState类的具体用法?C# ApplicationViewState怎么用?C# ApplicationViewState使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ApplicationViewState类属于命名空间,在下文中一共展示了ApplicationViewState类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Page_SizeChanged
private void Page_SizeChanged(object sender, SizeChangedEventArgs e)
{
ViewState = ApplicationView.Value;
if (ViewState == ApplicationViewState.Snapped)
{
if (Page.TopAppBar != null)
{
topBar = Page.TopAppBar;
Page.TopAppBar = null;
}
if (Page.BottomAppBar != null)
{
bottomBar = Page.BottomAppBar;
Page.BottomAppBar = null;
}
}
else if (topBar != null || bottomBar != null)
{
Page.TopAppBar = topBar;
Page.BottomAppBar = bottomBar;
topBar = null;
bottomBar = null;
}
OnApplicationViewStateChanged();
}
示例2: WindowSizeChanged
private static void WindowSizeChanged(object sender, Windows.UI.Core.WindowSizeChangedEventArgs e)
{
CurrentViewState = ApplicationView.Value;
if (CurrentViewState == ApplicationViewState.Filled)
{
System.Diagnostics.Debug.WriteLine("viewState is Filled");
}
else if (CurrentViewState == ApplicationViewState.FullScreenLandscape)
{
System.Diagnostics.Debug.WriteLine("viewState is FullScreenLandscape");
}
else if (CurrentViewState == ApplicationViewState.Snapped)
{
System.Diagnostics.Debug.WriteLine("viewState is Snapped");
}
else if (CurrentViewState == ApplicationViewState.FullScreenPortrait)
{
System.Diagnostics.Debug.WriteLine("viewState is FullScreenPortrait");
}
else
{
System.Diagnostics.Debug.WriteLine("viewState is something unexpected");
}
if (OnWindowLayoutRaised != null) OnWindowLayoutRaised(null, new WindowLayoutEventArgs() { ViewState = CurrentViewState, Size = e.Size });
}
示例3: DetermineVisualState
/// <summary>
/// Invoked to determine the name of the visual state that corresponds to an application
/// view state.
/// </summary>
/// <param name="viewState">The view state for which the question is being posed.</param>
/// <returns>The name of the desired visual state. This is the same as the name of the
/// view state except when there is a selected item in portrait and snapped views where
/// this additional logical page is represented by adding a suffix of _Detail.</returns>
protected override string DetermineVisualState(ApplicationViewState viewState)
{
// Update the back button's enabled state when the view state changes
//TODO-Removing thiss
var logicalPageBack = this.UsingLogicalPageNavigation(viewState);// && this.itemListView.SelectedItem != null;
var physicalPageBack = this.Frame != null && this.Frame.CanGoBack;
this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack;
// Determine visual states for landscape layouts based not on the view state, but
// on the width of the window. This page has one layout that is appropriate for
// 1366 virtual pixels or wider, and another for narrower displays or when a snapped
// application reduces the horizontal space available to less than 1366.
if (viewState == ApplicationViewState.Filled ||
viewState == ApplicationViewState.FullScreenLandscape)
{
var windowWidth = Window.Current.Bounds.Width;
if (windowWidth >= 1366) return "FullScreenLandscapeOrWide";
return "FilledOrNarrow";
}
// When in portrait or snapped start with the default visual state name, then add a
// suffix when viewing details instead of the list
var defaultStateName = base.DetermineVisualState(viewState);
return logicalPageBack ? defaultStateName + "_Detail" : defaultStateName;
}
示例4: SetLayout
public void SetLayout(ApplicationViewState viewState)
{
SnappedView.Visibility = viewState == ApplicationViewState.Snapped
? Windows.UI.Xaml.Visibility.Visible
: Windows.UI.Xaml.Visibility.Collapsed;
FullView.Visibility = viewState == ApplicationViewState.Snapped
? Windows.UI.Xaml.Visibility.Collapsed
: Windows.UI.Xaml.Visibility.Visible;
}
示例5: SetLayout
public void SetLayout(ApplicationViewState viewState)
{
FullItemGridView.Visibility = viewState == ApplicationViewState.Snapped
? Visibility.Collapsed
: Visibility.Visible;
SnappedItemGridView.Visibility = viewState == ApplicationViewState.Snapped
? Visibility.Visible
: Visibility.Collapsed;
}
示例6: SetLayout
public override void SetLayout(ApplicationViewState viewState)
{
SnappedView.Visibility = viewState == ApplicationViewState.Snapped
? Visibility.Visible
: Visibility.Collapsed;
FullView.Visibility = viewState == ApplicationViewState.Snapped
? Visibility.Collapsed
: Visibility.Visible;
}
示例7: DetermineVisualState
/// <summary>
/// Invoked to determine the name of the visual state that corresponds to an application
/// view state.
/// </summary>
/// <param name="viewState">The view state for which the question is being posed.</param>
/// <returns>The name of the desired visual state. This is the same as the name of the
/// view state except when there is a selected item in portrait and snapped views where
/// this additional logical page is represented by adding a suffix of _Detail.</returns>
protected override string DetermineVisualState(ApplicationViewState viewState)
{
// Update the back button's enabled state when the view state changes
var logicalPageBack = this.UsingLogicalPageNavigation(viewState) && this.itemListView.SelectedItem != null;
var physicalPageBack = this.Frame != null && this.Frame.CanGoBack;
this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack;
// Start with the default visual state name, and add a suffix when logical page
// navigation is in effect and we need to display details instead of the list
var defaultStateName = base.DetermineVisualState(viewState);
return logicalPageBack ? defaultStateName + "_Detail" : defaultStateName;
}
示例8: SetLayout
public override void SetLayout(ApplicationViewState viewState)
{
Visibility snappedVisibility = viewState == ApplicationViewState.Snapped
? Windows.UI.Xaml.Visibility.Visible
: Windows.UI.Xaml.Visibility.Collapsed;
Visibility fullVisibility = viewState != ApplicationViewState.Snapped
? Windows.UI.Xaml.Visibility.Visible
: Windows.UI.Xaml.Visibility.Collapsed;
SnappedAppBar.Visibility = snappedVisibility;
SnappedHeader.Visibility = snappedVisibility;
FullAppBar.Visibility = fullVisibility;
FullHeader.Visibility = fullVisibility;
}
示例9: handleChangeEvents
void handleChangeEvents(Size size, ApplicationViewState orientation, bool snapped)
{
if (ResponsiveMethods == null)
return;
foreach (var method in ResponsiveMethods)
{
method.HandleChange(size,
orientation,
snapped,
this.Resources.MergedDictionaries);
}
}
示例10: determineStyle
void determineStyle(ApplicationViewState newOrientation, IList<ResourceDictionary> resources)
{
//no orientation change has occurred, ignore
if (newOrientation == ApplicationViewState.Filled)
return;
var lastOrientation = state;
state = newOrientation;
//some flags to simplify detecting an orientation change
var wasBlank = (lastOrientation == null);
var wasPortrait = (lastOrientation == ApplicationViewState.FullScreenPortrait ||
lastOrientation == ApplicationViewState.Snapped);
var wasLandscape = (lastOrientation == ApplicationViewState.FullScreenLandscape);
var isPortrait = (newOrientation == ApplicationViewState.FullScreenPortrait ||
newOrientation == ApplicationViewState.Snapped);
var isLandscape = (newOrientation == ApplicationViewState.FullScreenLandscape);
//STYLE SWITCHING
//only switch on orientation change
if (isLandscape && (wasBlank || wasPortrait))
{
//clear existing responsive styles if any
removeExistingStyles(resources);
//add compact style xaml to resources
if (this.LandscapeStyles != null)
{
foreach (var style in this.LandscapeStyles)
resources.Add(style);
}
}
else if (isPortrait && (wasBlank || wasLandscape))
{
//clear existing responsive styles if any
removeExistingStyles(resources);
//add regular style xaml to resources
if (this.PortraitStyles != null)
{
foreach (var style in this.PortraitStyles)
resources.Add(style);
}
}
}
示例11: DetermineVisualState
protected override string DetermineVisualState(ApplicationViewState viewState)
{
// 基于窗口的宽度(而非视图状态)来确定横向布局的
// 可视状态。此页具有一个适用于
// 1366 个虚拟像素或更宽的显示屏的布局,还具有一个适用于较窄的显示屏(或对齐的
// 应用程序将可用水平空间减小为小于 1366 个像素的情况)的布局。
if (viewState == ApplicationViewState.Filled ||
viewState == ApplicationViewState.FullScreenLandscape)
{
var windowWidth = Window.Current.Bounds.Width;
if (windowWidth >= 1366) return "FullScreenLandscape";
return "Filled";
}
return base.DetermineVisualState(viewState);
}
示例12: DetermineVisualState
protected override string DetermineVisualState(ApplicationViewState viewState)
{
var logicalPageBack = UsingLogicalPageNavigation(viewState);// && this.itemListView.SelectedItem != null;
var physicalPageBack = Frame != null && Frame.CanGoBack;
DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack;
if (viewState == ApplicationViewState.Filled || viewState == ApplicationViewState.FullScreenLandscape)
{
var windowWidth = Window.Current.Bounds.Width;
if (windowWidth >= 1366)
return "FullScreenLandscapeOrWide";
return "FilledOrNarrow";
}
var defaultStateName = base.DetermineVisualState(viewState);
return defaultStateName;
return logicalPageBack ? defaultStateName + "_Detail" : defaultStateName;
}
示例13: DetermineVisualState
/// <summary>
/// Richiamato per determinare lo stato di visualizzazione corrispondente a quello di
/// un'applicazione.
/// </summary>
/// <param name="viewState">Stato di visualizzazione in merito a cui viene posta la domanda.</param>
/// <returns>Nome dello stato di visualizzazione desiderato. È lo stesso nome utilizzato per lo
/// stato di visualizzazione, eccetto quando un elemento è selezionato nelle visualizzazioni Portrait e Snapped, nei cui casi
/// questa pagina logica aggiuntiva viene rappresentata aggiungendo un suffisso _Detail.</returns>
protected override string DetermineVisualState(ApplicationViewState viewState)
{
// Aggiorna lo stato abilitato del pulsante Indietro quando viene modificato lo stato di visualizzazione
var logicalPageBack = this.UsingLogicalPageNavigation(viewState) && this.itemListView.SelectedItem != null;
var physicalPageBack = this.Frame != null && this.Frame.CanGoBack;
this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack;
// Determinare gli stati di visualizzazione per i layout orizzontali basati non sullo stato di visualizzazione, ma
// sulla larghezza della finestra. Questa pagina presenta un layout appropriato per
// almeno 1366 pixel virtuali e un altro per display più stretti o quando un'applicazione ancorata
// riduce lo spazio orizzontale disponibile a meno di 1366.
if (viewState == ApplicationViewState.Filled ||
viewState == ApplicationViewState.FullScreenLandscape)
{
var windowWidth = Window.Current.Bounds.Width;
if (windowWidth >= 1366) return "FullScreenLandscapeOrWide";
return "FilledOrNarrow";
}
// In caso di layout verticale o snapped iniziare con il nome di uno stato di visualizzazione predefinito, quindi aggiungere un
// suffisso per la visualizzazione dei dettagli anziché l'elenco
var defaultStateName = base.DetermineVisualState(viewState);
return logicalPageBack ? defaultStateName + "_Detail" : defaultStateName;
}
示例14: DetermineVisualState
/// <summary>
/// Invoked to determine the name of the visual state that corresponds to an application
/// view state.
/// </summary>
/// <param name="viewState">The view state for which the question is being posed.</param>
/// <returns>The name of the desired visual state. This is the same as the name of the
/// view state except when there is a selected item in portrait and snapped views where
/// this additional logical page is represented by adding a suffix of _Detail.</returns>
protected override string DetermineVisualState(ApplicationViewState viewState)
{
SplitViewModel viewModel = ((SplitViewModel)DataContext);
viewModel.UsingLogicalPageNavigation = viewState == ApplicationViewState.FullScreenPortrait || viewState == ApplicationViewState.Snapped;
bool logicalItemView = viewModel.UsingLogicalPageNavigation && viewModel.SelectedItem != null;
// Determine visual states for landscape layouts based not on the view state, but
// on the width of the window. This page has one layout that is appropriate for
// 1366 virtual pixels or wider, and another for narrower displays or when a snapped
// application reduces the horizontal space available to less than 1366.
if (viewState == ApplicationViewState.Filled ||
viewState == ApplicationViewState.FullScreenLandscape)
{
var windowWidth = Window.Current.Bounds.Width;
if (windowWidth >= 1366) return "FullScreenLandscapeOrWide";
return "FilledOrNarrow";
}
// When in portrait or snapped start with the default visual state name, then add a
// suffix when viewing details instead of the list
var defaultStateName = base.DetermineVisualState(viewState);
return logicalItemView ? defaultStateName + "_Detail" : defaultStateName;
}
示例15: UsingLogicalPageNavigation
// Visual state management typically reflects the four application view states directly
// (full screen landscape and portrait plus snapped and filled views.) The split page is
// designed so that the snapped and portrait view states each have two distinct sub-states:
// either the item list or the details are displayed, but not both at the same time.
//
// This is all implemented with a single physical page that can represent two logical
// pages. The code below achieves this goal without making the user aware of the
// distinction.
/// <summary>
/// Invoked to determine whether the page should act as one logical page or two.
/// </summary>
/// <param name="viewState">The view state for which the question is being posed, or null
/// for the current view state. This parameter is optional with null as the default
/// value.</param>
/// <returns>True when the view state in question is portrait or snapped, false
/// otherwise.</returns>
private bool UsingLogicalPageNavigation(ApplicationViewState? viewState = null)
{
if (viewState == null) viewState = ApplicationView.Value;
return viewState == ApplicationViewState.FullScreenPortrait ||
viewState == ApplicationViewState.Snapped;
}