現在、Silverlight 2.0 Beta 2 でテストしています。私の目標は、リソース要素を一度定義してから、レンダリングで何度も再利用することです。この単純な例では、四角形 (myRect) をリソースとして定義し、それを 2 回再利用しようとしましたが、次のエラーで失敗しました。
属性 {StaticResource myRect} の値が範囲外です。[ライン: 9 ポジション: 83]
ところで、このサンプルは WPF で正常に動作します。
<UserControl x:Class="ReuseResourceTest.Page"
xmlns="http://schemas.microsoft.com/client/2007"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Width="200" Height="200">
<Canvas x:Name="LayoutRoot" Background="Yellow">
<Canvas.Resources>
<RectangleGeometry x:Key="myRect" Rect="25,50,25,50" />
</Canvas.Resources>
<Path Stroke="Black" StrokeThickness="10" Data="{StaticResource myRect}" />
<Path Stroke="White" StrokeThickness="4" Data="{StaticResource myRect}" />
</Canvas>
</UserControl>
ここで何が起こっているかについての考え。
ありがとう、
-- エド