XML WPF网格
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:own="clr-namespace:WpfApplication1"
Title="Window1" Height="279" Width="613">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="100" />
<ColumnDefinition Width="*" />
<ColumnDefinition Width="2*" />
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="100" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<Grid Grid.Column="1" Grid.RowSpan="2">
<Label Content="Label" Background="AliceBlue"></Label>
</Grid>
</Grid>
</Window>
XML 资源文件中的WPF模板
<Application x:Class="WpfApplication1.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
StartupUri="Window1.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="Resource.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<ControlTemplate x:Key="buttonTemplate" TargetType="{x:Type Button}">
<Grid>
<Ellipse x:Name="outerCircle">
<Ellipse.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="Blue" />
<GradientStop Offset="1" Color="Red" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Ellipse x:Name="innerCircle" RenderTransformOrigin=".5,.5">
<Ellipse.RenderTransform>
<ScaleTransform ScaleX=".8" ScaleY=".8" />
</Ellipse.RenderTransform>
<Ellipse.Fill>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Offset="0" Color="Red" />
<GradientStop Offset="1" Color="Blue" />
</LinearGradientBrush>
</Ellipse.Fill>
</Ellipse>
<Viewbox>
<ContentPresenter Margin="{TemplateBinding Padding}" />
</Viewbox>
</Grid>
<ControlTemplate.Triggers>
<Trigger Property="IsMouseOver" Value="True">
<Setter TargetName="outerCircle" Property="Fill" Value="Orange" />
</Trigger>
<Trigger Property="IsPressed" Value="True">
<Setter Property="RenderTransform" >
<Setter.Value>
<ScaleTransform ScaleX=".9" ScaleY=".9" />
</Setter.Value>
</Setter>
<Setter Property="RenderTransformOrigin" Value=".5,.5"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
<Style x:Key="buttonStyle" TargetType="{x:Type Button}">
<Setter Property="Foreground" Value="Blue" />
<Setter Property="Background" Value="Black" />
<Setter Property="FontSize" Value="14" />
</Style>
</ResourceDictionary>
<Grid>
<Button Margin="275,112,241,106" Name="button1" Template="{StaticResource buttonTemplate}" Click="button1_Click">Text</Button>
<Button Margin="275,0,241,59" Name="button2" Style="{StaticResource buttonStyle}" Click="button1_Click" Height="23" VerticalAlignment="Bottom">Text</Button>
</Grid>
XML WPF数据绑定
<Window x:Class="WpfApplication1.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="279" Width="613" Loaded="Window_Loaded" >
<Window.Resources>
</Window.Resources>
<StackPanel >
<ScrollBar x:Name="Sb1"
Minimum="18"
Maximum="170"
Width="{Binding RelativeSource={RelativeSource self},Path=Value}"
Height="240"
Canvas.Top="44" Canvas.Bottom="181"
>
</ScrollBar>
<TextBox Height="35"
Text="{Binding ElementName=Sb1, Path=Value, Mode=OneWay, UpdateSourceTrigger=PropertyChanged}"
Width="182" Canvas.Top="294" Canvas.Bottom="100" />
</StackPanel>
</Window>
XML WPF动画
<Window x:Class="WpfApplication3.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Window1" Height="300" Width="500">
<Window.Resources>
<Style x:Key="widthAnim" TargetType="{x:Type Button}" >
<Style.Triggers>
<EventTrigger RoutedEvent="Button.Click" >
<BeginStoryboard >
<Storyboard Duration="00:05">
<DoubleAnimation AutoReverse="True" Storyboard.TargetProperty="Width" From="100" To="300" />
<ColorAnimation AutoReverse="True" Storyboard.TargetProperty="(Control.Foreground).(SolidColorBrush.Color)"
To="Red" />
</Storyboard>
</BeginStoryboard>
</EventTrigger>
</Style.Triggers>
</Style>
</Window.Resources>
<Grid>
<Button Margin="188,117,186,122" Name="button1" Style="{StaticResource widthAnim}" >Button</Button>
</Grid>
</Window>
XML .NET连接字符串
<connectionStrings>
<clear/>
<add name="NorthwindConnectionString"
connectionString="Data Source=SERVERNAME;Initial Catalog=Northwind;Persist Security Info=True;User ID=username;Password=password"
providerName="System.Data.SqlClient"/>
</connectionStrings>
XML 教程1,services-config.xml
<?xml version="1.0" encoding="UTF-8"?>
<services-config>
<services>
<service id="amfphp-flashremoting-service"
class="flex.messaging.services.RemotingService"
messageTypes="flex.messaging.messages.RemotingMessage">
<destination id="amfphp">
<channels>
<channel ref="my-amfphp"/>
</channels>
<properties>
<source>*</source>
</properties>
</destination>
</service>
</services>
<channels>
<channel-definition id="my-amfphp" class="mx.messaging.channels.AMFChannel">
<endpoint uri="/amfphp/gateway.php" class="flex.messaging.endpoints.AMFEndpoint"/>
</channel-definition>
</channels>
</services-config>
XML Google Calendar Feed Hello World
<?xml version='1.0' encoding='UTF-8'?>
<feed xmlns='http://www.w3.org/2005/Atom'
xmlns:openSearch='http://a9.com/-/spec/opensearchrss/1.0/'
xmlns:batch='http://schemas.google.com/gdata/batch'
xmlns:gCal='http://schemas.google.com/gCal/2005'
xmlns:gd='http://schemas.google.com/g/2005'>
<id>
http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full
</id>
<updated>2007-11-03T13:29:24.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2005#event' />
<title type='text'>Christoph Schmitt</title>
<subtitle type='text'>Christoph Schmitt</subtitle>
<link rel='alternate' type='text/html'
href='http://www.google.com/calendar/embed?src=chris.schmitt3@googlemail.com' />
<link rel='http://schemas.google.com/g/2005#feed'
type='application/atom+xml'
href='http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full' />
<link rel='http://schemas.google.com/g/2005#batch'
type='application/atom+xml'
href='http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full/batch' />
<link rel='self' type='application/atom+xml'
href='http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full?max-results=25' />
<author>
<name>Christoph Schmitt</name>
<email>chris.schmitt3@googlemail.com</email>
</author>
<generator version='1.0' uri='http://www.google.com/calendar'>
Google Calendar
</generator>
<openSearch:totalResults>2</openSearch:totalResults>
<openSearch:startIndex>1</openSearch:startIndex>
<openSearch:itemsPerPage>25</openSearch:itemsPerPage>
<gCal:timezone value='Europe/Berlin' />
<entry>
<id>
http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full/0v33namabg9spv3t3l0hi6edsc
</id>
<published>2007-11-03T13:27:39.000Z</published>
<updated>2007-11-03T13:27:39.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2005#event' />
<title type='text'>Ein Sigulares Event</title>
<content type='text'></content>
<link rel='alternate' type='text/html'
href='http://www.google.com/calendar/event?eid=MHYzM25hbWFiZzlzcHYzdDNsMGhpNmVkc2MgY2hyaXMuYXVzc2VtM0Bnb29nbGVtYWlsLmNvbQ'
title='alternate' />
<link rel='self' type='application/atom+xml'
href='http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full/0v33namabg9spv3t3l0hi6edsc' />
<author>
<name>Christoph Schmitt</name>
<email>chris.schmitt3@googlemail.com</email>
</author>
<gd:comments>
<gd:feedLink
href='http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full/0v33namabg9spv3t3l0hi6edsc/comments' />
</gd:comments>
<gd:eventStatus
value='http://schemas.google.com/g/2005#event.confirmed' />
<gd:transparency
value='http://schemas.google.com/g/2005#event.opaque' />
<gCal:uid value='0v33namabg9spv3t3l0hi6edsc@google.com' />
<gCal:sequence value='0' />
<gd:when startTime='2007-10-30T12:30:00.000+01:00'
endTime='2007-10-30T13:30:00.000+01:00' />
<gd:who rel='http://schemas.google.com/g/2005#event.organizer'
valueString='Christoph Schmitt' email='chris.schmitt3@googlemail.com' />
<gd:where valueString='' />
</entry>
<entry>
<id>
http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full/iugruct6k945inrr7liathkgvo
</id>
<published>2007-11-03T13:27:07.000Z</published>
<updated>2007-11-03T13:27:07.000Z</updated>
<category scheme='http://schemas.google.com/g/2005#kind'
term='http://schemas.google.com/g/2005#event' />
<title type='text'>Weekly Event Nov - Dec</title>
<content type='text'>Ein Woechentliches Test Event</content>
<link rel='alternate' type='text/html'
href='http://www.google.com/calendar/event?eid=aXVncnVjdDZrOTQ1aW5ycjdsaWF0aGtndm9fMjAwNzExMDNUMTMzMDAwWiBjaHJpcy5hdXNzZW0zQGdvb2dsZW1haWwuY29t'
title='alternate' />
<link rel='self' type='application/atom+xml'
href='http://www.google.com/calendar/feeds/chris.schmitt3%40googlemail.com/public/full/iugruct6k945inrr7liathkgvo' />
<author>
<name>Christoph Schmitt</name>
<email>chris.schmitt3@googlemail.com</email>
</author>
<gd:recurrence>
DTSTART;TZID=Europe/Berlin:20071103T143000
DTEND;TZID=Europe/Berlin:20071103T153000
RRULE:FREQ=WEEKLY;WKST=MO;UNTIL=20071208T133000Z;BYDAY=SA
BEGIN:VTIMEZONE TZID:Europe/Berlin
X-LIC-LOCATION:Europe/Berlin BEGIN:DAYLIGHT
TZOFFSETFROM:+0100 TZOFFSETTO:+0200 TZNAME:CEST
DTSTART:19700329T020000
RRULE:FREQ=YEARLY;BYMONTH=3;BYDAY=-1SU END:DAYLIGHT
BEGIN:STANDARD TZOFFSETFROM:+0200 TZOFFSETTO:+0100
TZNAME:CET DTSTART:19701025T030000
RRULE:FREQ=YEARLY;BYMONTH=10;BYDAY=-1SU END:STANDARD
END:VTIMEZONE
</gd:recurrence>
<gd:eventStatus
value='http://schemas.google.com/g/2005#event.confirmed' />
<gd:transparency
value='http://schemas.google.com/g/2005#event.opaque' />
<gCal:uid value='iugruct6k945inrr7liathkgvo@google.com' />
<gCal:sequence value='0' />
<gd:who rel='http://schemas.google.com/g/2005#event.organizer'
valueString='Christoph Schmitt' email='chris.schmitt3@googlemail.com' />
<gd:where valueString='Aachen, Pauustr' />
</entry>
</feed>
XML GData HelloWorld
<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom">
<title>Foo</title>
<updated>2006-01-23T16:26:03-08:00</updated>
<id>http://www.example.com/myFeed</id>
<author>
<name>Jo March</name>
</author>
<link href="/myFeed" rel="self"/>
<entry>
<id>1</id>
<link rel="edit" href="http://example.com/myFeed/1/1/"/>
<updated>2006-01-23T16:26:03-08:00</updated>
<author>
<name>Elizabeth Bennet</name>
<email>liz@gmail.com</email>
</author>
<title type="text">Entry 1</title>
<content type="text">This is my entry</content>
<g:item_type>Recipes</g:item_type>
<g:cooking_time>30</g:cooking_time>
<g:main_ingredient>chicken</g:main_ingredient>
<g:main_ingredient>chili peppers</g:main_ingredient>
<g:main_ingredient>peanuts</g:main_ingredient>
<g:spices_used>Szechuan peppercorn</g:spices_used>
<g:cook_technique>blackened</g:cook_technique>
</entry>
</feed>
XML Hibernate XML Mapping
<?xml version="1.0"?>
<!DOCTYPE hibernate-mapping PUBLIC
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd">
<hibernate-mapping package="eg">
<class
name="Blog"
table="BLOGS">
<id
name="id"
column="BLOG_ID">
<generator class="native"/>
</id>
<property
name="name"
column="NAME"
not-null="true"
unique="true"/>
<bag
name="items"
inverse="true"
order-by="DATE_TIME"
cascade="all">
<key column="BLOG_ID"/>
<one-to-many class="BlogItem"/>
</bag>
</class>
</hibernate-mapping>
XML Hibernate XML配置文件
<?xml version="1.0" encoding="utf-8"?>
<!DOCTYPE hibernate-configuration PUBLIC
"-//Hibernate/Hibernate Configuration DTD 3.0//EN"
"http://hibernate.sourceforge.net/hibernate-configuration-3.0.dtd">
<hibernate-configuration>
<session-factory>
<!-- SQL dialect -->
<property name="dialect">org.hibernate.dialect.HSQLDialect</property>
<!-- Database connection settings -->
<property name="connection.driver_class">org.hsqldb.jdbcDriver</property>
<property name="connection.url">jdbc:hsqldb:data/music</property>
<property name="connection.username">sa</property>
<property name="connection.password"></property>
<property name="connection.shutdown">true</property>
<!-- JDBC connection pool (use the built-in one) -->
<property name="connection.pool_size">1</property>
<!-- Enable Hibernate's automatic session context management -->
<property name="current_session_context_class">thread</property>
<!-- Disable the second-level cache -->
<property
name="cache.provider_class">org.hibernate.cache.NoCacheProvider</property>
<!-- disable batching so HSQLDB will propagate errors correctly. -->
<property name="jdbc.batch_size">0</property>
<!-- Echo all executed SQL to stdout -->
<property name="show_sql">true</property>
<!-- List all the mapping documents we're using -->
<mapping resource="com/oreilly/hh/data/Track.hbm.xml"/>
</session-factory>
</hibernate-configuration>