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(); }
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 }); }
/// <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; }
public void SetLayout(ApplicationViewState viewState) { FullItemGridView.Visibility = viewState == ApplicationViewState.Snapped ? Visibility.Collapsed : Visibility.Visible; SnappedItemGridView.Visibility = viewState == ApplicationViewState.Snapped ? Visibility.Visible : Visibility.Collapsed; }
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; }
public override void SetLayout(ApplicationViewState viewState) { SnappedView.Visibility = viewState == ApplicationViewState.Snapped ? Visibility.Visible : Visibility.Collapsed; FullView.Visibility = viewState == ApplicationViewState.Snapped ? Visibility.Collapsed : Visibility.Visible; }
/// <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; }
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); } }
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; }
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); } } }
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); }
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; }
/// <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; }
/// <summary> /// Se invoca para determinar el nombre del estado visual correspondiente al /// estado de vista de una aplicación. /// </summary> /// <param name="viewState">Estado de vista para el que se plantea la cuestión.</param> /// <returns>Nombre del estado visual deseado. Este coincide con el nombre del /// estado de vista, salvo cuando hay un elemento seleccionado en las vistas Portrait y Snapped donde /// esta página lógica adicional se representa mediante la adición de un sufijo de _Detail.</returns> protected override string DetermineVisualState(ApplicationViewState viewState) { // Actualizar el estado habilitado del botón Atrás al cambiar el estado de vista var logicalPageBack = this.UsingLogicalPageNavigation(viewState) && this.itemListView.SelectedItem != null; var physicalPageBack = this.Frame != null && this.Frame.CanGoBack; this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack; // Determinar los estados visuales para los diseños de tipo Landscape en función no del estado de vista, sino // del ancho de la ventana. Esta página tiene un diseño apropiado para un ancho de // 1366 píxeles virtuales o más y otro para presentaciones más estrechas o aquellas en las que una aplicación en estado // Snapped reduce el espacio horizontal disponible a menos de 1366 píxeles. if (viewState == ApplicationViewState.Filled || viewState == ApplicationViewState.FullScreenLandscape) { var windowWidth = Window.Current.Bounds.Width; if (windowWidth >= 1366) return "FullScreenLandscapeOrWide"; return "FilledOrNarrow"; } // En las vistas Portrait o Snapped, comenzar con el nombre de estado visual predeterminado y, a continuación, agregar un // sufijo al ver los detalles en lugar de la lista var defaultStateName = base.DetermineVisualState(viewState); return logicalPageBack ? defaultStateName + "_Detail" : defaultStateName; }
/// <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; }
/// <summary> /// 在确定对应于应用程序视图状态的视觉状态的名称时进行 /// 视图状态。 /// </summary> /// <param name="viewState">提出的问题所针对的视图状态。</param> /// <returns>所需的视觉状态的名称。此名称与视图状态的名称相同, /// 但在纵向和对齐视图中存在选定项时例外,在纵向和对齐视图中, /// 此附加逻辑页通过添加 _Detail 后缀表示。</returns> protected override string DetermineVisualState(ApplicationViewState viewState) { // 在视图状态更改时更新后退按钮的启用状态 var logicalPageBack = this.UsingLogicalPageNavigation(viewState) && this.itemListView.SelectedItem != null; var physicalPageBack = this.Frame != null && this.Frame.CanGoBack; this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack; // 基于窗口的宽度(而非视图状态)来确定横向布局的 // 可视状态。此页面具有一个适用于 // 1366 个虚拟像素或更宽的显示屏的布局,还具有一个适用于较窄的显示屏(或对齐的 // 应用程序将可用水平空间减小为小于 1366 个像素的情况)的布局。 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 logicalPageBack ? defaultStateName + "_Detail" : defaultStateName; }
/// <summary> /// Wird aufgerufen, um den Namen des visuellen Zustands zu bestimmen, der dem Ansichtszustand einer Anwendung /// entspricht. /// </summary> /// <param name="viewState">Der Ansichtszustand, für den die Frage gestellt wird.</param>L /// <returns>Der Name des gewünschten visuellen Zustands. Dieser ist identisch mit dem Namen des /// Ansichtszustands, außer wenn ein ausgewähltes Element im Hochformat und in der angedockten Ansicht vorliegt, wobei /// diese zusätzliche logische Seite durch Hinzufügen des Suffix _Detail dargestellt wird.</returns> protected override string DetermineVisualState(ApplicationViewState viewState) { // Den Aktivierungszustand der Schaltfläche "Zurück" aktualisieren, wenn der Ansichtszustand geändert wird var logicalPageBack = this.UsingLogicalPageNavigation(viewState) && this.itemListView.SelectedItem != null; var physicalPageBack = this.Frame != null && this.Frame.CanGoBack; this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack; // Visuelle Zustände für Querformatlayouts nicht auf dem Ansichtszustand, sondern der Breite // des Fensters basierend festlegen. Für diese Seite gibt es ein Layout, das für // 1366 virtuelle Pixel oder breiter geeignet ist, und ein anderes für schmalere Anzeigen oder wenn eine angedockte // Anwendung den verfügbaren horizontalen Raum auf weniger als 1366 Pixel reduziert. if (viewState == ApplicationViewState.Filled || viewState == ApplicationViewState.FullScreenLandscape) { var windowWidth = Window.Current.Bounds.Width; if (windowWidth >= 1366) return "FullScreenLandscapeOrWide"; return "FilledOrNarrow"; } // Im Hochformat oder bei angedockter Anwendung mit dem visuellen Standardzustandsnamen starten, dann ein // Suffix hinzufügen, wenn Details anstatt der Liste angezeigt werden var defaultStateName = base.DetermineVisualState(viewState); return logicalPageBack ? defaultStateName + "_Detail" : defaultStateName; }
/// <summary> /// 叫用以判斷對應到應用程式檢視狀態之視覺狀態的 /// 檢視狀態。 /// </summary> /// <param name="viewState">提出問題之檢視狀態。</param> /// <returns>想要之視覺狀態的名稱。這與檢視狀態的名稱相同, /// 但若在縱向及快照檢視中已有選取的項目,且 /// 檢視中這個其他的邏輯頁面是以加入 _Detail 後置字元來表示時則不然。</returns> protected override string DetermineVisualState(ApplicationViewState viewState) { // 當檢視狀態變更時,更新上一頁按鈕的啟用狀態 var logicalPageBack = this.UsingLogicalPageNavigation(viewState) && this.itemListView.SelectedItem != null; var physicalPageBack = this.Frame != null && this.Frame.CanGoBack; this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack; // 不根據檢視狀態決定橫向配置的視覺狀態,而是 // 根據視窗的寬度。這一頁有一個配置用於 // 1366 或更寬的虛擬像素,還有另一個配置用於較窄的顯示幕或用在次 // 應用程式將水平可用空間縮減到小於 1366 時。 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 logicalPageBack ? defaultStateName + "_Detail" : defaultStateName; }
void OnApplicationViewChanged(object sender, ViewStateChangedEventArgs e) { ApplicationViewState = e.ViewState; // Update the world viewport based on the view state if (ApplicationViewState == ApplicationViewState.FullScreenLandscape) { WorldViewport.Width = 1600; WorldViewport.Height = 900; } if (ApplicationViewState == ApplicationViewState.FullScreenPortrait) { WorldViewport.Width = 900; WorldViewport.Height = 1600; } if (ApplicationViewState == ApplicationViewState.Snapped) { WorldViewport.Width = GraphicsManager.ScreenViewport.Width; WorldViewport.Height = GraphicsManager.ScreenViewport.Height; } if (ApplicationViewState == ApplicationViewState.Filled) { WorldViewport.Width = 1600; WorldViewport.Height = 1200; } // Show the windows mouse if the game is snapped (to make it easier to change back to a supported state) IsMouseVisible = ApplicationViewState == ApplicationViewState.Snapped ? true : false; }
void OnLoad(object sender, RoutedEventArgs e) { PieChecked = true; service = ApplicationViewState.GetService(); service.Register(this); }
public ViewStateChangedEventArgs(ApplicationViewState newViewstate) { ViewState = newViewstate; }
public void Initialize(CoreWindow coreWindow, UIElement inputElement, TouchQueue touchQueue) { _coreWindow = coreWindow; _windowEvents = new InputEvents(_coreWindow, inputElement, touchQueue); _orientation = ToOrientation(DisplayProperties.CurrentOrientation); DisplayProperties.OrientationChanged += DisplayProperties_OrientationChanged; _coreWindow.SizeChanged += Window_SizeChanged; _coreWindow.Closed += Window_Closed; _coreWindow.Activated += Window_FocusChanged; #if !WINDOWS_PHONE81 _currentViewState = ApplicationView.Value; #endif var bounds = _coreWindow.Bounds; SetClientBounds(bounds.Width, bounds.Height); SetCursor(false); }
/// <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="InvalidateLayoutVisualState"/> public virtual string GetLayoutVisualState(ApplicationViewState viewState) { return(viewState.ToString()); }
private async void openfolderasync(object sender, RoutedEventArgs e) { ApplicationViewState viewstate = new ApplicationViewState(); viewstate = ApplicationView.Value; if (viewstate == ApplicationViewState.Snapped) { ApplicationView.TryUnsnap(); } FolderPicker ff = new FolderPicker(); var ls = new List<string> { ".3g2", ".3gp2", ".3gp", ".3gpp", ".m4a", ".m4v", ".mp4v", ".mp4", ".mov", ".m2ts", ".asf", ".wm", ".vob", ".wmv", ".wma", ".aac", ".adt", ".mp3", ".wav", ".avi", ".ac3", ".ec3" }; foreach (var s in ls) { ff.FileTypeFilter.Add(s); } ff.SuggestedStartLocation = PickerLocationId.ComputerFolder; StorageFolder folder = await ff.PickSingleFolderAsync(); if (folder != null) { var QueryOptions = new QueryOptions ( CommonFileQuery.OrderByName, new List<string> { ".3g2", ".3gp2", ".3gp", ".3gpp", ".m4a", ".m4v", ".mp4v", ".mp4", ".mov", ".m2ts", ".asf", ".wm", ".vob", ".wmv", ".wma", ".aac", ".adt", ".mp3", ".wav", ".avi", ".ac3", ".ec3" } ); var FileQuery = folder.CreateFileQueryWithOptions(QueryOptions); var ass = await FileQuery.GetFilesAsync(); file = ass; try { await pickingfiles(); } catch { ErrorCorrecting("026"); } } }
/// <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"/> private static string DetermineVisualState(ApplicationViewState viewState) { return viewState.ToString(); }
public void HandleChange(Size size, ApplicationViewState orientation, bool snapped, IList<ResourceDictionary> resources) { determineStyle(orientation, resources); }
private void WindowSizeChanged(object sender, WindowSizeChangedEventArgs e) { ApplicationViewState viewState = ApplicationView.Value; VisualStateManager.GoToState(this, viewState.ToString(), false); }
protected void SetState(ApplicationViewState state) { SetState(state.ToString()); }
/// <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) { return viewState.ToString(); }
/// <summary> /// アプリケーションのビューステートに対応する表示状態の名前を確認するために /// 呼び出されます。 /// </summary> /// <param name="viewState">問題が発生しているビューステートです。</param> /// <returns>目的の表示状態の名前。これは、縦向きビューおよびスナップ /// ビューでアイテムが選択され、_Detail というサフィックスが追加されたこの追加の論理ページが /// 存在している場合を除き、ビューステートの名前と同じです。</returns> protected override string DetermineVisualState(ApplicationViewState viewState) { // ビューステートが変更されたときに [戻る] が有効にされている状態を更新します var logicalPageBack = this.UsingLogicalPageNavigation(viewState); var physicalPageBack = this.Frame != null && this.Frame.CanGoBack; this.DefaultViewModel["CanGoBack"] = logicalPageBack || physicalPageBack; // ビューステートではなくウィンドウの幅を基にして横向きレイアウトの表示状態を // 決定します。このページの 1 つのレイアウトは 1366 仮想ピクセル以上に適しており、 // 別のレイアウトはより幅が狭いディスプレイや、スナップされたアプリケーションによって // 表示可能な横のスペースが 1366 未満に狭められている場合に適しています。 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 logicalPageBack ? defaultStateName + "_Detail" : defaultStateName; }
/// <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) { return(viewState.ToString()); }
void OwningCalendarSizeChanged(object sender, SizeChangedEventArgs e) { _applicationViewState = ApplicationView.Value; VisualStateManager.GoToState(this, _applicationViewState.ToString(), false); }
public abstract void SetLayout(ApplicationViewState viewState);
// 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; }
/// <summary> /// Updates the UI from the code-behind to accomodate changes in the size of the window. /// </summary> /// <param name="path">The new size of the window.</param> /// <param name="viewState">The orientation of the window.</param> protected virtual void WindowSizeChanged(Size s, ApplicationViewState viewState) { }