---
title: "WPF and Visual Studio"
author: "iseesea"
date: "2011-01-26T21:21:11Z"
tags: ["Blend", "C#", "Microsoft", "UI", "WPF"]
categories: ["编程语言"]
slug: "wpf-and-visual-studio"
draft: false
lastmod: "2011-01-26T21:21:11Z"
id: 897678
url: "https://iseesea.iteye.com/blog/897678"
---

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 -&gt; New project -&gt; 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; // When app is loading, MainWindow will be start; 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; Mｙ　Ｅｘａｍｐｌｅ: Create a new WPF　Ａｐｐ，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 We should write C# function to deal with events Dragging and DragFinished;