[Simple introduction to Windows 10] split-screen control (SplitView)

Source: Internet
Author: User

[Simple introduction to Windows 10] split-screen control (SplitView)
4.18 split-screen control (SplitView)

The split-screen control (SplitView) is a new control type added to Windows 10 and is also an interactive control promoted by Windows 10 general applications. It is usually presented with a hamburger button as a drawer menu. The control's XAML syntax is as follows:

<SplitView>

<SplitView. Pane>

...... Menu panel content

</SplitView. Pane>

...... Subject content

</SplitView>

The SplitView control consists of two parts: the menu panel and the main content. The menu panel is assigned a value through the Pane attribute, the IsPaneOpen attribute is used to control the Opening and Closing statuses. true indicates opening, and false indicates closing. When the menu is closed, the main Content of SplitView is displayed on the page. The topic Content is the Content attribute, and the simple XAML syntax can be directly written in the SplitView node.

The following is an example of the SplitView control: Implementing the hamburger menu.

Code list 4-18:SplitView control (source code: Chapter 4th \ Examples_4_18)

MainPage. the main code of the xaml file is Grid <Grid Background = "{ThemeResource ApplicationPageBackgroundThemeBrush}"> <ToggleButton Click = "Button_Click" verticalignment = "Top" Foreground = "Green"> <tog. content> <Border Background = "Transparent" Width = "40" Height = "40"> <FontIcon x: name = "Hamburger" FontFamily = "Segoe MDL2 Assets" Glyph = "& # xE700;"/> </Border> </ToggleButton. content> </ToggleButton> <SplitView x: Name = "Splitter" IsPaneOpen = "True"> <SplitView. pane> <StackPanel VerticalAlignment = "Center"> <Button Content = "menu 1" Click = "Button_Click_1"> </Button> <Button Content = "menu 2" Click = "Button_Click_1 "> </Button> <Button Content =" menu 3 "Click =" Button_Click_1 "> </Button> <Button Content =" menu 4 "Click =" Button_Click_1 "> </ button> </StackPanel> </SplitView. pane> <Grid> <TextBlock x: name = "tb" Text = "" verticalignment = "Center" HorizontalAlignment = "Center"> </TextBlock> </Grid> </SplitView> </Grid>
MainPage. xaml. cs file main code handler // hamburger icon button event processing private void Button_Click (object sender, RoutedEventArgs e) {Splitter. IsPaneOpen = (Splitter. IsPaneOpen = true )? False: true;} // handle private void Button_Click_1 (object sender, RoutedEventArgs e) {Splitter. isPaneOpen = false; tb. text = "hello" + (sender as Button ). content. toString ();}

This article comes from the introduction of Windows 10 universal application development

Source code download: http://vdisk.weibo.com/u/2186322691

Directory: http://www.cnblogs.com/linzheng/p/5021428.html

Welcome to my weibo @ WP Lin Zheng public account: wp Development (No.: wpkaifa)

Windows 10/WP technology exchange group: 284783431

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.