当前位置: 首页>>代码示例>>C#>>正文


C# ApplicationViewState类代码示例

本文整理汇总了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();
        }
开发者ID:stevehansen,项目名称:vidyano_v1,代码行数:27,代码来源:VidyanoPage.cs

示例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 });

        }
开发者ID:rolandsmeenk,项目名称:ModernApps,代码行数:30,代码来源:WindowLayoutService.cs

示例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;
        }
开发者ID:karpinsn,项目名称:ZOMGComics,代码行数:33,代码来源:ComicStripPage.xaml.cs

示例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;
 }
开发者ID:michaellperry,项目名称:MyCon,代码行数:9,代码来源:MyScheduleView.xaml.cs

示例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;
 }
开发者ID:michaellperry,项目名称:MyCon,代码行数:9,代码来源:AllSessionsView.xaml.cs

示例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;
 }
开发者ID:michaellperry,项目名称:MyCon,代码行数:9,代码来源:SessionView.xaml.cs

示例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;
        }
开发者ID:cbhl,项目名称:LndrMeWin8App,代码行数:20,代码来源:SplitPage.xaml.cs

示例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;
        }
开发者ID:michaellperry,项目名称:MyCon,代码行数:14,代码来源:MainPage.xaml.cs

示例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);
            }

        }
开发者ID:punker76,项目名称:XAMLResponsiveStyles,代码行数:14,代码来源:ResponsiveApp.cs

示例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);
                }

            }
        }
开发者ID:punker76,项目名称:XAMLResponsiveStyles,代码行数:49,代码来源:ResponsiveOrientation.cs

示例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);
 }
开发者ID:zdybit,项目名称:RememberIt,代码行数:15,代码来源:Index.xaml.cs

示例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;
        }
开发者ID:darkin100,项目名称:MarkPadRT,代码行数:18,代码来源:MainPage.xaml.cs

示例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;
        }
开发者ID:sicil1ano,项目名称:WindowsBlogReader--Sample-app-,代码行数:32,代码来源:SplitPage.xaml.cs

示例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;
        }
开发者ID:Valks,项目名称:Okra,代码行数:32,代码来源:SplitPage.xaml.cs

示例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;
        }
开发者ID:julianatanasoae,项目名称:BlogApp,代码行数:23,代码来源:SplitPageFilteredByTag.xaml.cs


注:本文中的ApplicationViewState类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。