WPF getting started in five minutes

Source: Internet
Author: User
Tags dotnet

I don't know why. My major is always changing, although my work is stable.
C ++ builder-> Asp.net-> JAVA-> C # winform-> VC-> CAD Secondary Development-> revit Secondary Development
I always have to learn new things to complete the task.

The revit development interface is very important, and WPF is very necessary.
Fortunately, I have Div + CSS basics and made some time for Silverlight

Only now can we find that what we have learned can be used sooner or later. xml and LINQ are also very common in revit development.
I hope you will not be like me.
Enter the WPF portal today.

Open vs2010 to create a WPF ApplicationProgram.
WPF is mainly used to control the location of Windows controls and display a dazzling interface.

Note two points.
1. Interface Control, similar to Div + CSS
Complex interfaces are displayed through margin, padding, and background.
<Grid> similar to <Table>

2. Event Response, program startup, and common Windows development analogy learning.
2.1 The main () function is not available,
The app class inherited from system. Windows. application is equivalent to the program. CS containing main ().
Open app. XAML and set the startup form in the startupuri attribute.
2.2 event response is no different from normal Windows development.
2.3 user controls are no different from Windows user controls.

Code:
Mainwindow. XAML

< Window X: Class = "Wpfapp. mainwindow"
Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml"
Title = "Http://dotnet.5d6d.com" Height = "350" Width = "525" >
< Grid >
< Grid. rowdefinitions >
< Rowdefinition Height = "50" > </ Rowdefinition >
< Rowdefinition Height = "30" > </ Rowdefinition >
</ Grid. rowdefinitions >
< Grid. columndefinitions >
< Columndefinition Width = "100" > </ Columndefinition >
< Columndefinition Width = "150" > </ Columndefinition >
</ Grid. columndefinitions >
< Textbox Name = "Txtvalue" Grid. Row = "0" Grid. Column = "0" Margin = "5, 10, 8, 3" > </ Textbox >
< Button Name = "Btnok" Grid. Row = "1" Grid. Column = "1" Width = "100" Height = "20" Click = "Btnok_click" > OK </ Button >
</ Grid >
</ Window >

App. XAML

< Application X: Class = "Wpfapp. app"
Xmlns = "Http://schemas.microsoft.com/winfx/2006/xaml/presentation"
Xmlns: x = "Http://schemas.microsoft.com/winfx/2006/xaml"
Startupuri = "Mainwindow. XAML" >
< Application. Resources >

</ Application. Resources >
</ Application >

This article source code download: http://dotnet.5d6d.com/thread-316-1-1.html
Level 2 domain name address for search engine included: http://greatverve.cnblogs.com/archive/2011/06/03/wpf-5.html

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.