Introduction to Windows 8 style application development 24 APP Bar Build

Source: Internet
Author: User

The purpose of building the application bar is to display navigation, commands, and tools that always hide unwanted use. We can place the application bar at the top or bottom of the page or at the top and bottom.

The default is hidden in AppBar and can be displayed or closed when the user clicks the right button, presses the win+z, or is relaxed from the top or bottom edge of the screen. AppBar Of course, we can also programmatically set the AppBar to display when the user makes a selection or interacts with the application.

Basic Steps for building AppBar

Usually we build an application AppBar that takes only three steps to complete:

How to build AppBar

Add AppBar to the application, you need to assign the AppBar control to the Topappbar or Bottomappbar property of the page.

The XAML code can be as follows:

<Page.BottomAppBar> <appbar x:name= "Bottomappbar" padding= "10,0,10,0" >   
       
                    <Grid> <stackpanel orientation= "horizontal" horizontalalignment= "left" > <button style= "{StaticResource Editappbarbuttonstyle}"/> ; Button style= ' {StaticResource removeappbarbuttonstyle} '/> <button style= ' {Staticreso  Urce Addappbarbuttonstyle} "/> </StackPanel> <stackpanel  orientation= "Horizontal" horizontalalignment= "right" > <button style= "{StaticResource  Refreshappbarbuttonstyle} "/> <button style=" {StaticResource Helpappbarbuttonstyle} " /> </StackPanel> </Grid> </appbar&   
       
Gt </pagE.bottomappbar> 

Resource styles referenced in XAML code can be found in Standardstyles.xaml files in the common folder of the application solution.

Operation Effect:

If we want to open appbar when the page is loaded, you can set the IsOpen property value of the AppBar control to True in XAML code, or you can control the open AppBar in C # code.

private void Openbutton_click (object sender, 

RoutedEventArgs e)   
       
{   
       
    Topappbar.isopen = true;   
       
}

When the user interacts anywhere other than the applied AppBar, the default is AppBar hidden. We can change the release mode by setting the Issticky property value to True.

The user only hides the AppBar when it is right-click, press Win+z, or swipe from the top or bottom edge of the screen.

private void Stickybutton_click (object 

sender, RoutedEventArgs e)   
       
{   
       
    bottomappbar.issticky = true;   
       
}

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.