Style usage
First, it is defined in XAML as part of the resource dictionary:
<! -- Add one item to the page's resource dictionary -->
<Phone:Phoneapplicationpage. Resources>
<! -- A style for the two text blocks in waitingforcallpanel -->
< Style X : Key = "Waitingtextstyle" Targettype = "Textblock">
< Setter Property = "Foreground" Value = "#99 ffffff"/>
< Setter Property = "Fontfamily"
Value = "{ Staticresource Phonefontfamilysemibold } "/>
< Setter Property = "Fontsize" Value = "23"/>
</ Style >
</Phone:Phoneapplicationpage. Resources>
You can reference it directly in XAML:
<TextblockX:Name= "Taptohidetextblock"Margin="Text= "(TAP screen to hide )"Style= "{StaticresourceWaitingtextstyle} "/>
Note: style does not support dynamic binding. It cannot be changed as follows:
APP Lifecycle
Two statuses of APP Exit: closed and deactived (deactived is also called tombstoned)
OPEN CLOSEDProgram, The program is reinitialized.
Open the deactived program, and the program continues to run.
The only way to change to closed: Click Back on the initial Page of the program. Because of this, other exit methods should be deactive, that is, they can be found in the back stack.
The deactived program cannot be active again because of insufficient memory or shutdown.
Open the program by touching the icon (whether or not the program was opened before), it is launch rather than active. After the program is re-opened, the program page in the back stack will be deleted.
Obscured and unobscured events
An obsured event is triggered when a call is sent, a toast notification is received, or a screen lock is triggered. If the user receives a call to cut out the current program, the deactived event is triggered.
The handler of an obscured cannot know the specific cause. The only thing that can know is whether the lock screen is caused by checking the islocked attribute of the event parameter.
Specify the event handler in APP. Xmal
< Application. applicationlifetimeobjects > <! -- Required object that handles lifetime events for the Application --> < Shell : Phoneapplicationservice Launching = "Application_launching" Closing = "Application_closing" Activated = "Application_activated" Deactivated = "Application_deactivated"/> </ Application. applicationlifetimeobjects >
Application State and page state
To save the status permanently, use isolated storage. To save the status temporarily, use two dictionary: application state and page state.
After actived, the program can still access the variables saved in application state and page state. Note that both close and re-launch will be cleared.
These temporary states can be used as cache, for example, to store data obtained from the Network (you do not have to obtain it again after actived is returned), and datacontext can also be used as an entry of the State dictionary.
Generally, in onnavigatedto, we decide where to read the data, and in onnavigatedfrom, we decide where to store the data.
Make sure that what deactived handler does includes what closing handler does, because if you want to save data during closing, you also need to save the data during deactived. Because how the program is closed depends on the user's behavior, there is no guarantee that the closing event will be triggered.
Controltemplate
Each control has a template attribute. Its type is controltemplate. Its function is to change the style of the control.
When customizing a style, you still need other properties of the control, which requires templatebinding. The content is relatively large. For details, refer:
Http://www.cnblogs.com/zhouyinhui/archive/2007/03/28/690993.html