XAML(eXtensible Application Markup Language,可扩展应用程序标记语言)是一种声明式的编程语言,遵循XML的语法。WPF使用XAML来设计UI具有易用性、高效性等特点。易用性主要表现在设计师在不需懂逻辑代码的情况下就可以使用Expression Blend设计出优雅的界面以及一些动画效果。我们将分两个大的部分来说明,一个是XAML基本认识,另一个是XAML中最重要的X命名空间。

1.XAML基本认识

下面我们新建一个WPF应用程序,看看Xaml页面有哪些基本的东西

从上图我们可以看出Xaml有一个根元素Window,根元素下有一个子元素Grid,表示出清晰的层级关系。Window还有一些属性(Attribute):

x:Class属于x命名空间的内容,我们后面详述

xmlns是XML Namespace的缩写,等号后面看起来像一个URL,其实是采用硬编码(Hard Code)的形式来引用一些.net命名空间。

如果要引用多个命名空间,为了区别,我们可以用标识前缀来限定修饰,如xmlns:x

Tilte、Height、Width属性用来修饰Window

1.1集合语法

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Ellipse Width="80" Height="80">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.6" Color="Green" />
<GradientStop Offset="1" Color="Blue" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
</Grid>
</Window>

RadialGradientBrush.GradientStops是一个GradientStop集合,我们可以像上面那样来编写

1.2Xaml内容属性

XAML 指定了一个语言功能,通过该功能,一个类可以指定它的一个且仅一个属性为 XAML 内容属性。 该对象元素的子元素用于设置该内容属性的值。 换言之,仅对内容属性而言,您可以在 XAML 标记中设置该属性时省略属性元素,并在标记中生成更直观的父级/子级形式。本文刚开始给了一张图片,在Window下放了一个Grid,其实它的完整写法应该是这样:

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Content>
<Grid> </Grid>
</Window.Content>
</Window>

由上面代码知道,Content属性是Window的默认内容属性,因此你可以直接省略它,这样看起来更直观。

1.3文本内容

有少量 XAML 元素可直接将文本作为其内容来处理。 若要实现此功能,必须满足以下条件之一:

1.类必须声明一个内容属性,并且该内容属性必须是可赋值给字符串的类型(该类型可以是 Object)。

2. 类型必须声明一个类型转换器,该类型转换器将文本内容用作其初始化文本。 例如,<Brush>Blue</Brush>。 这种情况实际上并不常见。

3.类型必须为已知的 XAML 语言基元。

我们来举个例子看看:

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Ellipse Width="80" Height="80">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.6" Color="Green" />
<GradientStop Offset="1" Color="Blue" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Button Grid.Column="2">
Button
<Button.Background>
Red
</Button.Background>
</Button>
</Grid>
</Window.Content>
</Window>

上面代码中Button有一个Content内容属性(可省略书写),其类型为Object,满足第一条;

Background属性是Brush类型,它是一个抽象类,系统内置有其子类SolidColorBrush类型转化器,故将会把Red文本(对应的#FF0000这种RGB文本值也可以)转换为SolidColorBrush类型,满足第二条,所以可以写成上面那样。

1.4自定义TypeConverter

上面我们知道,WPF内置许多的TypeConverter,使得我们在使用Xaml时能够随心所欲。下面我们也得实现一个TypeConverter:

首先创建一个Person类:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using XamlDemo;
using System.ComponentModel; namespace XamlDemo
{
[TypeConverter(typeof(StringToPersonTypeConverter))]
public class Person
{
public string Name { get; set; }
public Person Child { get; set; }
}
}

然后创建一个继承自TypeConverter的StringToPersonTypeConverter,重写里面的ConvertFrom方法:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.ComponentModel; namespace XamlDemo
{
class StringToPersonTypeConverter:TypeConverter
{
public override object ConvertFrom(ITypeDescriptorContext context, System.Globalization.CultureInfo culture, object value)
{
if (value is string)
{
Person p = new Person();
p.Name = value.ToString();
return p;
}
return base.ConvertFrom(context, culture, value);
}
}
}

然后在Xaml中使用:

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:XamlDemo"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="20" />
</Style>
<XmlDataProvider x:Key="xdp1" XPath="Students/Student">
<x:XData>
<Students xmlns="">
<Student Name="Jello"/>
<Student Name="Taffy"/>
</Students>
</x:XData>
</XmlDataProvider>
<local:Person x:Key="person1" Child="Jello" />
</Window.Resources>
<Window.Content>
<StackPanel x:Name="stackpanel1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Ellipse Width="80" Height="80">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.6" Color="Green" />
<GradientStop Offset="1" Color="Blue" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Button Grid.Column="2">
Button
<Button.Background>
#FF0000
</Button.Background>
</Button>
<TextBlock x:Name="txtblock1" Grid.Row="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Name="txtblock2" Grid.Row="2" Grid.Column="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Path=Text,ElementName=myTextBlock1}" Background="{x:Static Member=SystemColors.GrayTextBrush}" Style="{x:Null}" Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ListBox Grid.Column="2" Grid.Row="4" ItemsSource="{Binding Source={StaticResource xdp1}}" DisplayMemberPath="@Name"/>
</Grid>
<local:MyTextBlock Text="Hello" x:Name="myTextBlock1"/>
<local:MyTextBlock Text="Hello"/>
</StackPanel>
</Window.Content>
</Window>

后台代码如下:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes; namespace XamlDemo
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.txtblock1.Text = "World";
this.txtblock2.Text = "World"; //有x:Name修饰的MyTextBlock
this.myTextBlock1.Text = "World";
MessageBox.Show(this.myTextBlock1.Text); //无x:Name修饰的MyTextBlock
MyTextBlock myTextBlock = this.stackpanel1.Children[] as MyTextBlock;
if (myTextBlock != null)
{
myTextBlock.Text = "World";
MessageBox.Show(myTextBlock.Text);
} //自定义TypeConverter
Person p = this.FindResource("person1") as Person;
if (p != null)
{
MessageBox.Show(p.Child.Name);
}
}
}
}

这样,我们简单实现了一个TypeConverter。

2.x命名空间

由上面我们知道,xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"这个就是x命名空间,命名成x不是必须得,当然也可以命名成xmlns:y="http://schemas.microsoft.com/winfx/2006/xaml",这里只是约定而已(命名为x代表这是Xaml相关的命名空间)。我们来下里面都有些什么:

有上图可以看出x命名空间中主要有Attribute、标记扩展和指令元素三种。下面我们将分别看下具体使用:

2.1Attribute

我们拿最常使用的x:Name来看下:

Xaml代码:

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Window.Content>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Ellipse Width="80" Height="80">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.6" Color="Green" />
<GradientStop Offset="1" Color="Blue" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Button Grid.Column="2">
Button
<Button.Background>
#FF0000
</Button.Background>
</Button>
<TextBlock x:Name="txtblock1" Grid.Row="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Name="txtblock2" Grid.Row="2" Grid.Column="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
</Window.Content>
</Window>

后台代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes; namespace XamlDemo
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.txtblock1.Text = "World";
this.txtblock2.Text = "World";
}
}
}

运行发现两个TextBlock的文本显示都变成了World,那我们不经要问x:Name和Name有什么区别呢?我们知道TextBlock的Name属性是从FrameworkElement类中继承的,用于引用标签对应的实例,和ASPX中重的ID作用差不多,当一个标签或者自定义元素不是继承自FrameworkElement时,就无法获取它的Name属性了,这将导致在后台中访问该标签变得麻烦。我们举个例子来看下:

首先我们自定义一个继承自UIElement的MyTextBlock类,只有一个Text属性。

然后我们在Xaml中引用它,需要在根元素中加入xmlns:local="clr-namespace:XamlDemo",代码如下:

Xaml代码:

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:XamlDemo"
Title="MainWindow" Height="350" Width="525">
<Window.Content>
<StackPanel>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Ellipse Width="80" Height="80">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.6" Color="Green" />
<GradientStop Offset="1" Color="Blue" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Button Grid.Column="2">
Button
<Button.Background>
#FF0000
</Button.Background>
</Button>
<TextBlock x:Name="txtblock1" Grid.Row="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Name="txtblock2" Grid.Row="2" Grid.Column="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<local:MyTextBlock Text="Hello" x:Name="myTextBlock1"/>
<local:MyTextBlock Text="Hello"/>
</StackPanel>
</Window.Content>
</Window>

后台代码:

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes; namespace XamlDemo
{
/// <summary>
/// MainWindow.xaml 的交互逻辑
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
this.txtblock1.Text = "World";
this.txtblock2.Text = "World"; //有x:Name修饰的MyTextBlock
this.myTextBlock1.Text = "World";
MessageBox.Show(this.myTextBlock1.Text); //无x:Name修饰的MyTextBlock
MyTextBlock myTextBlock = this.stackpanel1.Children[] as MyTextBlock;
if (myTextBlock != null)
{
myTextBlock.Text = "World";
MessageBox.Show(myTextBlock.Text);
}
}
}
}

其实,x:Name的作用有两个:一是为标签生成对应的实例并可以用x:Name的值引用它;二是如果这个标签继承自FrameworkElement类,那么也让其Name属性来引用生成的实例。

2.2标记扩展

Xaml标记扩展对应System.Window.Markup.MarkupExtension抽象类,查看它的子类,点击这里

举个例子来说明它的用法:

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:XamlDemo"
Title="MainWindow" Height="350" Width="525">
<Window.Content>
<StackPanel x:Name="stackpanel1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Ellipse Width="80" Height="80">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.6" Color="Green" />
<GradientStop Offset="1" Color="Blue" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Button Grid.Column="2">
Button
<Button.Background>
#FF0000
</Button.Background>
</Button>
<TextBlock x:Name="txtblock1" Grid.Row="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Name="txtblock2" Grid.Row="2" Grid.Column="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Path=Text,ElementName=myTextBlock1}" Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center"/>
</Grid>
<local:MyTextBlock Text="Hello" x:Name="myTextBlock1"/>
<local:MyTextBlock Text="Hello"/>
</StackPanel>
</Window.Content>
</Window>

上面代码只是多加了一个TextBlock,看起来奇怪的是它的Text、Background和Style属性的值,是用一对大括号来包括的,这就是我们要说的标记扩展。

构造语法:{标记扩展类 [可选参数]},可选参数包括命名参数和定位参数。

标记扩展类:x:Null、x:Static和Binding;

命名参数:Binding中的Path和Element;

定位参数:x:Static中Member

这里还有一个{}转义序列的问题,请点击这里

2.3指令元素

主要就两个x:XData和x:Code,这里举个x:XData例子:

<Window x:Class="XamlDemo.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:XamlDemo"
Title="MainWindow" Height="350" Width="525">
<Window.Resources>
<Style TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="20" />
</Style>
<XmlDataProvider x:Key="xdp1" XPath="Students/Student">
<x:XData>
<Students xmlns="">
<Student Name="Jello"/>
<Student Name="Taffy"/>
</Students>
</x:XData>
</XmlDataProvider>
</Window.Resources>
<Window.Content>
<StackPanel x:Name="stackpanel1">
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
<RowDefinition Height="5" />
<RowDefinition Height="100" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
<ColumnDefinition Width="5" />
<ColumnDefinition Width="100" />
</Grid.ColumnDefinitions>
<Ellipse Width="80" Height="80">
<Ellipse.Fill>
<RadialGradientBrush GradientOrigin="0.5,0.5">
<RadialGradientBrush.GradientStops>
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="0.6" Color="Green" />
<GradientStop Offset="1" Color="Blue" />
</RadialGradientBrush.GradientStops>
</RadialGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Button Grid.Column="2">
Button
<Button.Background>
#FF0000
</Button.Background>
</Button>
<TextBlock x:Name="txtblock1" Grid.Row="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Name="txtblock2" Grid.Row="2" Grid.Column="2" Text="Hello" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<TextBlock Text="{Binding Path=Text,ElementName=myTextBlock1}" Background="{x:Static Member=SystemColors.GrayTextBrush}" Style="{x:Null}" Grid.Row="4" HorizontalAlignment="Center" VerticalAlignment="Center"/>
<ListBox Grid.Column="2" Grid.Row="4" ItemsSource="{Binding Source={StaticResource xdp1}}" DisplayMemberPath="@Name"/>
</Grid>
<local:MyTextBlock Text="Hello" x:Name="myTextBlock1"/>
<local:MyTextBlock Text="Hello"/>
</StackPanel>
</Window.Content>
</Window>

3.总结

这次主要是介绍Xaml相关的内容,讲的都是一些基础。自己在手写的过程,也重拾了已经遗忘的知识!

4.参考文献

1.MSDN(http://msdn.microsoft.com/zh-cn/library/ms754130%28v=vs.110%29.aspx)

2.深入浅出WPF(刘铁猛)

3.WPF高级编程

5.Xaml编译(补充内容)

Xaml的编译主要做三件事:

  1.转换为特殊的二进制格式Baml

  2.将Baml作为二进制资源嵌入程序集

  3.将Xaml和过程式代码链接起来

WPF学习(2)XAML的更多相关文章

  1. WPF学习笔记-用Expression Design制作矢量图然后导出为XAML

    WPF学习笔记-用Expression Design制作矢量图然后导出为XAML 第一次用Windows live writer写东西,感觉不错,哈哈~~ 1.在白纸上完全凭感觉,想象来画图难度很大, ...

  2. 学习WPF——了解WPF中的XAML

    XAML的简单说明 XAML是用于实例化.NET对象的标记语言,主要用于构建WPF的用户界面 XAML中的每一个元素都映射为.NET类的一个实例,例如<Button>映射为WPF的Butt ...

  3. WPF学习05:2D绘图 使用Transform进行控件变形

    在WPF学习04:2D绘图 使用Shape绘基本图形中,我们了解了如何绘制基本的图形. 这一次,我们进一步,研究如何将图形变形. 例子 一个三角形,经Transform形成组合图形: XAML代码: ...

  4. WPF学习之资源-Resources

    WPF学习之资源-Resources WPF通过资源来保存一些可以被重复利用的样式,对象定义以及一些传统的资源如二进制数据,图片等等,而在其支持上也更能体现出这些资源定义的优越性.比如通过Resour ...

  5. WPF学习之路初识

    WPF学习之路初识   WPF 介绍 .NET Framework 4 .NET Framework 3.5 .NET Framework 3.0 Windows Presentation Found ...

  6. WPF学习拾遗(二)TextBlock换行

    原文:WPF学习拾遗(二)TextBlock换行 下午在帮组里的同事解决一个小问题,为了以后方便,把就把它收集一下吧. 新建一个TextBlock作为最基础的一个控件,他所携带的功能相对于其他的控件要 ...

  7. WPF学习(8)数据绑定

    说到数据绑定,其实这并不是一个新的玩意儿.了解asp.net的朋友都知道,在asp.net中已经用到了这个概念,例如Repeater等的数据绑定.那么,在WPF中的数据绑定相比较传统的asp.net中 ...

  8. WPF 学习笔记-在WPF下创建托盘图标

    原文:WPF 学习笔记-在WPF下创建托盘图标 首先需要在项目中引用System.Windows.Forms,System.Drawing; using System; using System.Co ...

  9. (转)WPF学习资源整理

    由于笔者正在学习WPF,所以整理出网络中部分WPF的学习资源,希望对同样在学习WPF的朋友们有所帮助. 首推刘铁猛的<深入浅出WPF>系列博文 1.深入浅出WPF(1)——什么是WPFht ...

  10. WPF学习资源整理

    WPF(WindowsPresentation Foundation)是微软推出的基于Windows Vista的用户界面框架,属于.NET Framework 3.0的一部分.它提供了统一的编程模型 ...

随机推荐

  1. 关于java mail 发邮件的问题总结(转)

    今天项目中有需要用到java mail发送邮件的功能,在网上找到相关代码,代码如下: import java.io.IOException; import java.util.Properties; ...

  2. hdu - 4975 - A simple Gaussian elimination problem.(最大流量)

    意甲冠军:要在N好M行和列以及列的数字矩阵和,每个元件的尺寸不超过9,询问是否有这样的矩阵,是独一无二的N(1 ≤ N ≤ 500) , M(1 ≤ M ≤ 500). 主题链接:http://acm ...

  3. android选择和裁剪图像拍摄的图像

    转载请注明出处:http://blog.csdn.net/allen315410/article/details/39994913 近期从曾经的项目中扒下来一个经常使用的模块.在这里有必要记录一下的. ...

  4. 使用oracle数据库,多用户同时对一个表进行增加,删除,修改,查看等操作,会不会有影响?

    使用oracle数据库,多用户同时对一个表进行增加,删除,修改,查看等操作,会不会有影响? 1.问题:各操作间或者性能上会不会有影响? 如果有该如何解决? 多用户操作的影响主要是回锁定记录,oracl ...

  5. uva10465(完全背包,要求装满背包)

    http://uva.onlinejudge.org/index.php?option=com_onlinejudge&Itemid=8&page=show_problem&c ...

  6. Vs2012在Linux应用程序开发(3):加入新平台hi3516

    下面我们将VS2012添加一个新的平台支持,由于近来与哈斯hi3516.就选它吧! 1.1     复制平台文件 原来一直认为要让VS支持一个新的平台须要编写代码,某天在看MSBUILD文件夹的时候突 ...

  7. UVa 11408 - Count DePrimes

    题目:一个数的素因子的和假设也是素数就叫做DePrimes,统计给定区间内的DePrimes. 分析:数论.本题使用用一种素数的筛法,欧拉筛法,也加线性筛法. 这样的方法,每次删选分两种情况:1.素因 ...

  8. 添加xml文件编辑语法提示

    找到Struts的lib目录 找到struts2-core-文件并解压开 这个struts.dtd文件才是我们需要添加的文件 双击XML Catalog 点击ADD Key中复制粘贴D:\web\st ...

  9. PKI系统深入的介绍

    公钥基础设施(Public Key Infrastructure,缩写PKI)的基础与核心.是电子商务安全实施的基本保障.因此.对PKI技术的研究和开发成为眼下信息安全领域的热点. 本文对PKI技术进 ...

  10. wbadmin delete backup删除服务器旧的镜像备份