Kubernetes client UAP development and client uap

Source: Internet
Author: User

Kubernetes client UAP development and client uap

At the beginning of Windows 8, Modern apps were designed to run in full screen mode. To enable Windows to continue to have front-end multi-task capabilities when running the Modern app, Windows introduces a new split-screen technology, namely, "SnapView ". It allows the Modern app that supports this view to be pasted on one side of the screen and run at a screen size of 1/4 (actually about 333 in width of the logical resolution. This view is particularly suitable for tool applications (such as dictionaries) and instant messaging applications (such as QQ ). Split-screen multitasking has become an important feature of Windows 8, which is different from iPad and Android Pad.

When programmers considered that the Modern App adapted different views and screen resolutions, they generally considered Landscape View (FullScreenSize, Fill), Portriat View, and SnapView, and some common resolutions such as 1366*768 and 1920*1080.

It may be because the developers of Windows think that it is not enough to just use the system. It may also be because they have realized the true meaning of "Windows" again. Since Windows 10, the Modern app can run in the form of a window. Therefore, the window of the Modern app can be of almost any size. The display adaptation problem of the Windows Store App needs to be discussed again.

Generally, the judgment of the size change of the Modern app is as follows:

· VisualStateManager

· DetermineVisualState

· Window. SizeChanged

· OnApplyTheme

1. VisualStateManger is the most common and convenient method. Its usage is relatively simple. First read a piece of XAML code:

<Page><Grid x:Name=”LayoutGrid”><VisualStateManager.VisualStateGroups>            <!-- Visual states reflect the application's view state inside the FlipView -->            <VisualStateGroup>                <VisualState x:Name="FullScreenLandscape"/>                <VisualState x:Name="Filled">                    <Storyboard>                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="AutoCompleteContainer" Storyboard.TargetProperty="Width">                            <DiscreteObjectKeyFrame KeyTime="0" Value="800"/>                        </ObjectAnimationUsingKeyFrames>                    </Storyboard>                </VisualState>                <VisualState x:Name="FullScreenPortrait">                    <Storyboard>                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SP_Main" Storyboard.TargetProperty="Orientation">                            <DiscreteObjectKeyFrame KeyTime="0" Value="Vertical"/>                        </ObjectAnimationUsingKeyFrames>                    </Storyboard>                </VisualState>                <VisualState x:Name="Snapped">                    <Storyboard>                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="NavigationBarContainer" Storyboard.TargetProperty="Visibility">                            <DiscreteObjectKeyFrame KeyTime="0" Value="Collapsed"/>                        </ObjectAnimationUsingKeyFrames>                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SV_Main" Storyboard.TargetProperty="Style">                            <DiscreteObjectKeyFrame KeyTime="0" Value="{StaticResource VerticalScrollViewerStyle}"/>                        </ObjectAnimationUsingKeyFrames>                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="SP_Main" Storyboard.TargetProperty="Orientation">                            <DiscreteObjectKeyFrame KeyTime="0" Value="Vertical"/>                        </ObjectAnimationUsingKeyFrames>                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="searchBarControl" Storyboard.TargetProperty="Margin">                            <DiscreteObjectKeyFrame KeyTime="0" Value="10,0,10,0"/>                        </ObjectAnimationUsingKeyFrames>                        <ObjectAnimationUsingKeyFrames Storyboard.TargetName="searchBarControl" Storyboard.TargetProperty="Width">                            <DiscreteObjectKeyFrame KeyTime="0" Value="300"/>                        </ObjectAnimationUsingKeyFrames>                    </Storyboard>                </VisualState>            </VisualStateGroup>        </VisualStateManager.VisualStateGroups></Grid></Page>

The VisualStateManager code is located in LayoutGrid of the Page, and the adaptability changes to different views are given in the form of Storageboard. For example, we usually take more care of the "SnapView", such as the adjustment of the container width, the adjustment of the ScrollView direction, and the hiding of some auxiliary display controls. Fortunately, you only need to consider how to use the XAML code of VisualStateManager and do not need to consider how to return it. When the VisualState changes, StateManager first returns the view to the initial state and then executes new changes.

The PostgreSQL of the Bing dictionary is implemented in this way:

Protected override string DetermineVisualState (ApplicationViewState viewState) {if (viewState = ApplicationViewState. Snapped) {if (_ DefinitionControl! = Null) {_ DefinitionControl. SetToSnapStyle ();} Grid_Layout.RowDefinitions [0]. Height = new GridLength (60 );............ } Else {if (_ DefinitionControl! = Null) {_ DefinitionControl. SetToLandscapeStyle ();} Grid_Layout.RowDefinitions [0]. Height = new GridLength (80); // semanticZoom. IsZoomOutButtonEnabled = true ;}............. Return viewState. ToString ();}

In DetermineVisualState, You can manually add some code for some special processing, or use VisualStateManager to easily express changes. However, DetermineVisualState is not as convenient as VisualStateManager. You must know how to get it and how to get it back. The code here should be as few as possible.

3. Window. Current. SizeChanged

If you want to more precisely control the interface effect when the Window changes, you can seize the opportunity of Window. Current. SizeChanged:

protected override void OnNavigatedTo(NavigationEventArgs e){            Window.Current.SizeChanged += Current_SizeChanged;}Protected override void OnNavigatedFrom(NavigationeventArgs e){        Window.Current.SizeChanged-=Current_SizeChanged;}void Current_SizeChanged(object sender, WindowSizeChangedEventArgs e){//do something here            }

4. OnApplyTheme

Before a custom widget is displayed, OnApplyTheme is a common function used to flexibly assign values to page elements and modify the widget's appearance. Let's say "chestnut:

protected override void OnApplyTemplate() {            Grid layoutGrid = GetTemplateChild("Grid_Layout") as Grid;            if (_counter % 2 == 0)                layoutGrid.Background = Application.Current.Resources["HomepageDataContainerBackground1"] as SolidColorBrush;            else                layoutGrid.Background = Application.Current.Resources["HomepageDataContainerBackground2"] as SolidColorBrush;            StackPanel SP_KeyWords = GetTemplateChild("SP_KeyWords") as StackPanel;            int counter = 1;            foreach (KeyWord keyWord in _DailyNews.KeyWords)            {                KeyWordTile keyWordTile = new KeyWordTile(keyWord, counter);                keyWordTile.KeyWordClicked += dailyNewsTile_KeyWordTileClicked;                SP_KeyWords.Children.Add(keyWordTile);                counter++;            }…. Do other things.            base.OnApplyTemplate();        }

Having mastered the above four points, I believe everyone can make a Modern App that looks beautiful and is compatible with a wide range of apps.

Share code and change the world!

Windows Phone Store App link:

Bytes

Windows Store App link:

Http://apps.microsoft.com/windows/zh-cn/app/c76b99a0-9abd-4a4e-86f0-b29bfcc51059

GitHub open source link:

Https://github.com/MS-UAP/cnblogs-UAP

MSDN Sample Code:

Https://code.msdn.microsoft.com/CNBlogs-Client-Universal-477943ab

 

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.