<UserControl x:Class="SbSCh3_4.MainPage"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
mc:Ignorable="d"
d:DesignHeight="338" d:DesignWidth="400">
<UserControl.Resources>
<Style x:Key="PictureButton" TargetType="Button">
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="Button">
<Button Height="150" Width="257">
<Button.Content>
<StackPanel Height="141" HorizontalAlignment="Left" Name="stackPanel1" VerticalAlignment="Top" Width="204">
<Image Height="103" Name="image1" Stretch="Fill" Width="200" Source="/SbSCh3_4;component/quan_zhi_xian.jpg" />
<TextBlock Height="23" Name="textBlock1" Text="Fancy Books" TextAlignment="Center" FontFamily="Georgia" FontSize="12" />
</StackPanel>
</Button.Content>
</Button>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</UserControl.Resources>
<Grid x:Name="LayoutRoot" Background="White" Height="341">
<Button Style="{StaticResource PictureButton}" Margin="-10,-91,10,91" />
<Button Style="{StaticResource PictureButton}" Margin="-13,70,13,-70" />
</Grid>
</UserControl>
Silverlight4入门之样式与模板(十)
最新推荐文章于 2011-10-18 12:56:00 发布