"Programming WPF" translation 5th Chapter 1. Do not use styles

Source: Internet
Author: User

As an example of how a style can be used in WPF, let's look at TTT simple implementations, such as example 5-1.

Example 5-1

<!--Window1.xaml
<window
x:class= "Tictactoe.window1"
xmlns= HTTP://SCHEMAS.MICR osoft.com/winfx/avalon/2005 "
xmlns:x=" http://schemas.microsoft.com/winfx/xaml/2005
text= "TicTacToe" >
<!--The black background lets the Tic-Tac-Toe
<!--Crosshatch come through on the margins ;
<grid background= "Black"
<grid.rowdefinitions>
<rowdefinition/>
; RowDefinition/>
<rowdefinition/>
</grid.rowdefinitions>
<grid.columndefiniti     Ons>
<columndefinition/>
<columndefinition/>
<columndefinition/>
</grid.columndefinitions>
<button margin= "0,0,2,2" grid.row= "0" grid.column= "0" x:Name= "cell00"/> ;
<button margin= "2,0,2,2" grid.row= "0" grid.column= "1" x:name= "cell01"/>
<button margin= "2,0,0,2 "grid.row=" 0 "Grid.colUmn= "2" x:name= "cell02"/>
<button margin= "0,2,2,2" grid.row= "1" grid.column= "0" x:name= "Cell10"/>
<button margin= "2,2,2,2" grid.row= "1" grid.column= "1" x:name= "Cell11"/>
<button margin= "2,2,0,2" Grid . row= "1" grid.column= "2" x:name= "cell12"/>
<button margin= "0,2,2,0" grid.row= "2" grid.column= "0" x:name= "cel L20 "/>
<button margin=" 2,2,2,0 "grid.row=" 2 "grid.column=" 1 "x:name=" Cell21 "/>
<button Margi N= "2,2,0,0" grid.row= "2" grid.column= "2" x:name= "Cell22"/>
</grid>
</window>

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.