Hi,
I have the following XAML, which works fine in WPF, but not in Silverlight 4
<ItemsPanelTemplate x:Key="ContentListBoxItemsPanelTemplate">
<Canvas/>
</ItemsPanelTemplate>
<DataTemplate x:Key="ContentListBoxItemTemplate">
<Border CornerRadius="15" Width="150" Margin="3" Height="300">
<Border.Background>
<LinearGradientBrush StartPoint="0,0" EndPoint="0,1">
<GradientStop Color="OrangeRed" Offset="1" />
<GradientStop Color="Brown" Offset="0" />
</LinearGradientBrush>
</Border.Background>
</Border>
</DataTemplate>
<Style TargetType="ListBoxItem">
<Setter Property="Canvas.Left" Value="{Binding Left}"/>
<Setter Property="Canvas.Top" Value="{Binding Top}"/>
</Style>
And then somewhere:
<ListBox Name="ContentList"
ItemTemplate="{StaticResource ContentListBoxItemTemplate}"
ItemsPanel="{StaticResource ContentListBoxItemsPanelTemplate}" />
If I try the same thing in Silverlight I get an exception saying that the setter cannot set a read only property, but I still want to achieve the same thing in Silverlight without code.
Any suggestions?