运行时的样式:
XAML代码:
<Page
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Viewport3D>
<Viewport3D.Resources>
<XmlDataProvider x:Key="xmlData" Source="http://blog.csdn.net/johnsuna/rss.aspx">
</XmlDataProvider>
<OuterGlowBitmapEffect x:Key="outerGlow" GlowColor="Yellow" GlowSize="3" Noise="0" Opacity="0.4" />
<Style x:Key="rssBlogTitle" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="20"/>
<Setter Property="TextBlock.Foreground" Value="Red">
</Setter>
</Style>
<Style x:Key="rssTitle" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="12"/>
<Setter Property="TextBlock.Foreground">
<Setter.Value>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="Red" Offset="0"/>
<GradientStop Color="Orange" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</Setter.Value>
</Setter>
<Setter Property="BitmapEffect" Value="{StaticResource outerGlow}" />
</Style>
<Style x:Key="rssText" TargetType="{x:Type TextBlock}">
<Setter Property="FontSize" Value="2"/>
<Setter Property="Foreground" Value="Gray"/>
</Style>
</Viewport3D.Resources>
<Viewport3D.Camera>
<PerspectiveCamera
Position="2.8,2.5,4.5"
LookDirection="-.6,-.5,-1."
FieldOfView="16"
UpDirection="1,0,0"
>
</PerspectiveCamera>
</Viewport3D.Camera>
<ModelVisual3D>
<ModelVisual3D.Content>
<Model3DGroup>
<AmbientLight Color="White"></AmbientLight>
<GeometryModel3D>
<GeometryModel3D.Geometry>
<MeshGeometry3D
Positions="-1, -1, 0 1, -1, 0 -1, 1, 0 1, 1, 0"
TriangleIndices="2 0 1 3 2 1"
TextureCoordinates="1 1 1 0 0 1 0 0"
Normals="0,0,1 0,0,1 0,0,1 0,0,1">
</MeshGeometry3D>
</GeometryModel3D.Geometry>
<GeometryModel3D.Material>
<DiffuseMaterial>
<DiffuseMaterial.Brush>
<VisualBrush>
<VisualBrush.Visual >
<StackPanel>
<TextBlock Text="{Binding Source={StaticResource xmlData}, XPath=rss/channel/title}" Style="{StaticResource rssBlogTitle}" />
<ListBox ItemsSource="{Binding Source={StaticResource xmlData}, XPath=rss/channel/item}">
<ListBox.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<LinearGradientBrush.GradientStops>
<GradientStop Color="#FFFFFF" Offset="0.1"/>
<GradientStop Color="DarkGreen" Offset="1"/>
</LinearGradientBrush.GradientStops>
</LinearGradientBrush>
</ListBox.Background>
<ListBox.ItemTemplate>
<DataTemplate>
<StackPanel>
<TextBlock Text="{Binding XPath=title}" Style="{StaticResource rssTitle}"></TextBlock>
<TextBlock Text="{Binding XPath=description}" Style="{StaticResource rssText}" TextWrapping="Wrap"
></TextBlock>
</StackPanel>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
</StackPanel>
</VisualBrush.Visual>
</VisualBrush>
</DiffuseMaterial.Brush>
</DiffuseMaterial>
</GeometryModel3D.Material>
</GeometryModel3D>
</Model3DGroup>
</ModelVisual3D.Content>
</ModelVisual3D>
</Viewport3D>
</Page>
http://blog.csdn.net/johnsuna/rss.aspx中的RSS结构大致类似为:
<rss version="2.0" ...>
<channel>
<title>大可山博客[十年一日, GDI+,WPF, .Net图形图像]</title>
<link />
<description>WPF,WinForms,asp.net开发,图形图像处理系统研究 (Johnson Blog) [信奉:凡事靠自己] MSN:a3news(at)hotmail.com http://www.brawdraw.com</description>
<dc:language>zh-CN</dc:language>
<lastUpdateTime>Thu, 01 May 2008 19:47:00 GMT</lastUpdateTime>
<ttl>60</ttl>
<item>
<dc:creator>大可山(Johnson)</dc:creator>
<title>利用XSLT及C#.net将SVG转换为XAML</title>
<link>http://blog.csdn.net/johnsuna/archive/2008/04/22/2316568.aspx</link>
<pubDate>Tue, 22 Apr 2008 23:55:00 GMT</pubDate>
<guid>http://blog.csdn.net/johnsuna/archive/2008/04/22/2316568.aspx</guid>
<wfw:comment>comments/2316568.aspx</wfw:comment>
<comments>http://blog.csdn.net/johnsuna/archive/2008/04/22/2316568.aspx#Feedback</comments>
<slash:comments>1</slash:comments>
<wfw:commentRss>comments/commentRss/2316568.aspx</wfw:commentRss>
<trackback:ping>http://tb.blog.csdn.net/TrackBack.aspx?PostId=2316568</trackback:ping>
<description>本文讲解通过XSLT文件将SVG转换为XAML代码。<img src ="aggbug/2316568.aspx" width = "1" height = "1" /></description>
</item>
<!-- //多个item项 -->
</channel>
</rss>