Reputation: 131
I've got following issue:
I've got a ListBox which items are lain on Canvas. I would like to be able to xamly position its elements. The ItemContainerStyle looks like this:
<Style x:Key="ElementContainerStyle" TargetType="ListBoxItem" >
<Setter Property="Canvas.Top" Value="{Binding BoundingBox.Y}" />
<Setter Property="Canvas.Left" Value="{Binding BoundingBox.X}" />
<Setter Property="Width" Value="{Binding BoundingBox.Width}" />
<Setter Property="Height" Value="{Binding BoundingBox.Height}" />
...
</Style>
With such a style SL crashes with InnerException's message:
System.NotSupportedException: Cannot set read-only property
Why's that read-only property? If I put regular values there (not data bounded) it runs well, except - this is not what I wanted.
I was looking forward to new features for SL4 (like ability to bind to Width and Height properties), but it seems that such a trick still can't be done?
It works fine in WPF..
Anyone can shed some light on this?
Upvotes: 0
Views: 694