<Win10 development> some tips ., Win10 development tips
This article shares some scattered little knowledge about UWP development.
1. Set the minimum size of the application
It is mainly used on PCs. UWA can be played by the mouse at will on PCs, which can be large or small. The responsive design of the interface is a major feature. However, in some cases, we still need to consider that there are a lot of App interface elements, and the window will not be able to be placed any longer, so it will not look good. Medium,
The size of the flat bar of the IT house is the default minimum size for each UWA.
In order to display the information for at least three days, users are not allowed to adjust it too short.
The calculator makes the minimum size smaller than the default size, allowing itself to become an ultra-small window.
The following code sets the minimum size of the App, which is also 400x700.
applicationView.SetPreferredMinSize(new Size(400, 700));
2. slide into the animation in sequence during the pivotitem Switching
When the pivotitem switching option is selected, the entire page slides in the switching direction by default. In fact, there is another way to slide in sequence, which is interesting. In the WP8 era, a third-party Library provides this effect. Now UWP comes with it.
Assign a group to the child controls in pivotitem. Different Groups slide in sequence from sequence to sequence. Controls of the same group will slide in at the same time.
For example, <TextBlock consumer. SlideInAnimationGroup = "1"/>
The effect is as follows:
3. Modify the title style of a sequence.
You can modify the headerTempplate. The following code uses textblock as the header of the watermark and modifies the font size of the title.
<Symbol x: Uid = "symbol"> <symbol. headerTemplate> <DataTemplate> <TextBlock Text = "{Binding}" FontSize = "21"/> </DataTemplate> </Pivot emplate. headerTemplate> <shorttitem x: Uid = "shorttitem1" Header = "Search"> </shorttitem> </short>
4. Understand the platform currently running
UWA can run on multiple platforms. Some background operations need to be differentiated between the platforms currently running. You can access Windows. ApplicationModel. Resources. Core. ResourceContext.
The DeviceFamily values include Desktop and Mobile...
Example:
1 ResourceContext resourceContext =ResourceContext.GetForCurrentView();2 3 if (resourceContext.QualifierValues["DeviceFamily"] == "Desktop")4 {5 applicationView.SetPreferredMinSize(new Size(400, 700));6 }