1: The page has the extension:. xaml files like ASPX can write client display content and background processing content
The general front page is in the form of:
<Pagex:class= "Myfirstapp.mainpage"xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local= "Using:myfirstapp"xmlns:d= "http://schemas.microsoft.com/expression/blend/2008"XMLNS:MC= "http://schemas.openxmlformats.org/markup-compatibility/2006"mc:ignorable= "D"
<!-- reference namespaces -Xmlns:tabctl= "Using:customcontrol"
<!-- call the background pagesizechanged method --SizeChanged= "Pagesizechanged"
<!-- Settings page background color is white -- Background= "White"> <!--above toolbar - <Page.topappbar> <AppBarx:name= "Topbar"Issticky= "True"Style="{StaticResource Topbar}"Closed= "modetoolbar_closed"opened= "topbar_opened" > <Gridx:name= "Menugrid"VerticalAlignment= "Center"> <grid.columndefinitions> <ColumnDefinitionWidth= "+"/> <ColumnDefinitionMinWidth= "615"Width="*" /> <ColumnDefinitionWidth= "105> </Grid.ColumnDefinitions> <appbarbutton x:name="tooltest1 "Label= "Test1"Click= "btnTest_Click"></Appbarbutton> <Appbarbuttonx:name= "Tooltest2"Grid.column= "2"Label= "Test2"isenabled= "False"></Appbarbutton> </Grid> </AppBar> </Page.topappbar> <!--The following toolbar - <Page.bottomappbar> <AppBarx:name= "Modetoolbar"Issticky= "True"Style="{StaticResource Bottomappbar}" > <Gridx:name= "EditGrid"VerticalAlignment= "Center"> <grid.columndefinitions> <ColumnDefinitionWidth= "+" /> <ColumnDefinitionWidth= "The " /> </grid.columndefinitions> <Appbarbuttonx:name= "Tooltest3"Grid.column= "1"HorizontalAlignment= "Center"Label= "Test3" ></Appbarbutton> <Appbarbuttonx:name= "Tooltest4"Grid.column= "2"HorizontalAlignment= "Center"Label= "Test4" ></Appbarbutton> </Grid> </AppBar> </Page.bottomappbar></Page>
2: General steps for using StaticResource reference styles
Create the Styles folder and create the Styles.xaml file in the folder
Delete Styles.xaml.cs file
Open the Styles.xaml file and write the style code as follows
<ResourceDictionaryxmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local= "Using:myfirstappstyles">
<Stylex:key= "Topbar"TargetType= "AppBar"> <Setter Property= "Height"Value= "$"/> <Setter Property= "Background"Value= "#CC222846"/> </Style>
</ResourceDictionary>
Configuring Association files in App.xaml
<Applicationx:class= "Myfirstapp.app"xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"xmlns:local= "Using:myfirstapp"> <!--Associating resources Files - <application.resources> <ResourceDictionary> <resourcedictionary.mergeddictionaries> <ResourceDictionarySource= "Styles/styles.xaml" /> </resourcedictionary.mergeddictionaries> </ResourceDictionary> </application.resources> </Application>
Windows PHONE Development-Getting Started program building