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. 虚拟化技术学习(一)在VMware虚拟机中安装KVM

    近期一直研究虚拟化技术,曾经对VMware虚拟机有一定的了解,近期突发奇想,能不能在VMware虚拟机中再装一个虚拟机呢? 那么问题就来了,首先,你须要一台电脑,vmware软件,(本人的电脑配置渣渣 ...

  2. 两个实验操作系统-ubuntu在安装配置pintos

    安前两次莫名其妙, 蛋疼的实验操作系统.. 首先下错了总结第一次. 使用最后gdb调试pintos什么时候, 这个错误将被报告: bochsrc.txt:8: Bochs is not compile ...

  3. Solaris 10下使用Python3

    通常在Solaris 10上仅仅能使用Python2.x. 假设使用Python3的话,一种就是http://www.sunfreeware.com获取可用的二进制版本号.只是眼下这个站点已经不提供免 ...

  4. Yii 控制dropdownlist / select 控件的宽度和 option 的宽度

    默认情况下, option的宽度会由options中最宽的元素决定,并且同时决定着select控件的宽度 在Yii中,如果需要自定义select控件的宽度,可以用 htmlOptions定义,如下: ...

  5. 用数据说话,外贸产品选择(中篇)-google趋势分析法

    在上篇文章<用数据说话,贸B2C产品选择(上篇)-热门搜索法>中我们能搜索出来几种产品了,那我们就拿上次搜索出来的热门产品来做一个趋势分析.我们经过几个站点挑出了几种热卖产品Wedding ...

  6. Python编程预约参观北京行动纲要

    通过Python程序来模拟一个统一平台预约参观北京,包含验证码识别.登陆.据医院.时间.有关主管部门号等查询. 此程序仅供学习使用,请勿用于其他用途. 1.验证码图片 def getCodePic() ...

  7. petshop4.0 其中详细解释(系统架构)

    前言:PetShop它是一个例子.微软用它来展示.Net容量企业系统开发.业界有很多.Net与J2EE争议.微软许多数据PetShop和Sun的PetStore从.这样的争论是不可避免的带有强烈的商业 ...

  8. 【剑指offer】打印单列表从尾部到头部

    转载请注明出处:http://blog.csdn.net/ns_code/article/details/25028525 剑指offer上的第五题,在九度OJ上測试通过. 时间限制:1 秒 内存限制 ...

  9. SQL Tuning Advisor一个错误ORA-00600: internal error code, arguments: [kesqsMakeBindValue:obj]

    跑SELECT dbms_sqltune.report_tuning_task(:tuning_task) FROM dual;  错误消息,如下面: ORA-00600: internal erro ...

  10. 令人无限遐想的各种PCIe加速板卡

    声明 本文不涉及不论什么特定API,也不针对不论什么特定的厂商,可是仍然值得透露一点的是,某些加速板卡厂商的成功点和失败点恰恰都是在于其通用性,在这个人们依旧依赖专业板卡的时代,依旧将板卡视为解决专业 ...