WPF and Visual Studio

WPF: Using VS, we can create 2 kinds of WPF applications, one is desktop application " WPF Application" another is Web RIA application " WPF Browser Application";
VS: An IDE;
Create a WPF "Hello world" Application:
File -> New project -> WPF Application; (HelloWorld)

We can see the auto-create file at the VS right panel Solution Explorer, where display all files of our project; And we should know the usage of each file and folder:
Properties folder contain and properties of project; we can add new resource from here;
Reference folder contain some libs for running project;
app.config is configurations file;
app.xaml is whole layout setting, the Application will load this file at first;
<Application x:Class="HelloWorld.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="MainWindow.xaml"> // When app is loading, MainWindow will be start;
<Application.Resources>
</Application.Resources>
</Application>
In this files tree, every instance of window have a branch like MainWindow; And xaml file is layout file, corresponding cs file is C# file which will respond to all requests and events sent from window;
When we create a new window, we can use grid to set layout;
We need to write much C# code to deal with the event; WPF offer some basic event, to which we can depart some complex event;
My Example:
Create a new WPF App,C_SMS,
First thing we need to set the most top Grid, to build a nice frame to display your layout; you can design your Grid at UI design view, it's very easy and intuitive to make it out;
now, you have an static UI,what you need to do just add some events; there are a simple way to implement Dragging control; right click "solution explorer" to add reference, and find two lib files:
"Microsoft.Expression.Interactions.dll"
"System.Windows.Interactivity.dll"
from MS expression blend 4
then add below to MainWindow.xaml
xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
xmlns:b="http://schemas.microsoft.com/expression/2010/interactions"
add below to control which you want to drag it
<i:Interaction.Behaviors>
<b:MouseDragElementBehavior Dragging="" DragFinished=""/>
</i:Interaction.Behaviors>
We should write C# function to deal with events Dragging and DragFinished;
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值