WPF嵌入式资源使用方法
<Page x:Class="WpfWebApp.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:uc="clr-namespace:WpfLibruary;assembly=WpfLibruary"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:WpfWebApp"
Title="Page1" Height="332" Width="757" VerticalAlignment="Top">
<Page.Resources>
<local:PersonCollection x:Key="PersonC">
<local:Person Id="1" Name="Cgc1" />
<local:Person Id="2" Name="Cgc2" />
<local:Person Id="3" Name="Cgc3" />
</local:PersonCollection>
</Page.Resources>
<Grid Height="289">
<TextBlock FontSize="24" TextWrapping="Wrap" Margin="0,0,0,-19.998">
<Hyperlink x:Name="LnkPre" NavigateUri="Page2.xaml" Foreground="Black">
Enter Page2
</Hyperlink>
</TextBlock>
<Button Margin="358,43,214,0" Name="button1" Click="button1_Click" Height="49.024" VerticalAlignment="Top">Button</Button>
<ListBox ItemsSource="{StaticResource PersonC}" IsSynchronizedWithCurrentItem="True" x:Name="LstPerson" HorizontalAlignment="Left" Width="297" Height="131" VerticalAlignment="Top">
<ListBox.ItemTemplate>
<DataTemplate>
<DockPanel>
<TextBlock Text="{Binding Path=Id}"></TextBlock>
<TextBlock Text="分分:"></TextBlock>
<TextBlock Text="{Binding Path=Name}"></TextBlock>
</DockPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</Grid>
</Page>
public class Person
{
public Person()
{ }
public Person(Int32 Id, String Name)
{
this.Id = Id;
this.Name = Name;
}
public Int32 Id
{
get;
set;
}
public String Name
{
get;
set;
}
}
public class PersonCollection : System.Collections.ObjectModel.ObservableCollection<Person>
{
}
http://www.infoq.com/cn/news/2008/04/silverlight2-tutorials
http://www.cnblogs.com/Clingingboy/archive/2008/06/25/1230047.html