Weekend charge of WPF (i)

Source: Internet
Author: User

Chase the play has caught up with the speed of the update, suddenly feel all of a sudden idle. Taking advantage of this time, just learn some WPF. See here, a lot of people estimate the technology house is about equal to the single dog, haha. Well, get into the learning state quickly.

The focus on WPF, or interest in it, is mostly about the pursuit of good things. Although it seems like a little bit (B), it does. Look accustomed to the company a client side of the WinForm interface, really can not endure. Of course, WinForm can also beautify the interface through other third-party components, such as DevExpress, DotNetBar. This is good, but I always cling to a better appearance. Even seconds to kill or have the effect once and for all. So I searched for WPF. Interest in it has the following points:

1.  

After all, I was just learning it, the next content slot may also be a lot, but welcome mad spray.

The first WPF program to get started:

Create it, the steps are all in the picture, don't ask me how to point out this window.

After the creation, there is actually an interesting discovery, which is so much like creating a Web form that you can directly create some controls directly from HTML-like

Some simple uses of controls and properties:

<Windowx:class= "grid. MainWindow "xmlns= "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"xmlns:x= "Http://schemas.microsoft.com/winfx/2006/xaml"Title= "MainWindow"Height= " the"Width= "525">    <Grid>        <!--width of rows and columns the default width is equal to everyone -        <grid.columndefinitions>            <!--column -            <ColumnDefinition></ColumnDefinition>            <ColumnDefinition></ColumnDefinition>            <ColumnDefinition></ColumnDefinition>        </grid.columndefinitions>        <grid.rowdefinitions>            <!--Line -            <RowDefinitionHeight= "$"></RowDefinition>            <RowDefinition></RowDefinition>            <RowDefinition></RowDefinition>            <RowDefinition></RowDefinition>        </grid.rowdefinitions>        <!--This is an additional property -        <ButtonGrid.Row= "1"Grid.column= "1"></Button>        <TextBoxText= "Hello"Grid.Row= "0"Grid.column= "2"Background= "Red"></TextBox>        <ImageSource= "1.jpg"Grid.Row= "3"></Image>    </Grid></Window>

Drawings: (purely for familiarity, not aesthetics)

The code example above is actually the WPF Grid layout, followed by a somewhat responsive layout format StackPanel.

StackPanel : Default is automatic from top to bottom , and can change automatically with form size [ similar to reactive ]

If you need to change how the content is presented, you can set the vertical or horizontal arrangement by Orientation

The first small section of the study is completed, the next step is to write a simple login window, and through the background automatically create a control to complete a similar to the simple layout of the game.

Weekend charge of WPF (i)

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.