this is in SL 1.0 or SL 2.0 Beta 1?

can  you use code and not xaml? if it is 2.0 Beta 1

On 5/11/08, Andrea Boschin <[EMAIL PROTECTED]> wrote:
>
> Hi all,
>
> I'm going crazy doing a quite simple thing (so... I thinked it is simple
> :D)
>
> I have an ItemsControl binded to a collection of Points (x,y) and this
> control has an ItemsPanel set to <Canvas />
>
> Now I need to bind the X and Y property to the Canvas.Left and Canvas.Top
> of a Rectangle I put into the ItemTemplate property
> to have the resulting rectangles distribuited in the canvas area according
> to the x and y properties (I'm drawing the plan of a cinema seats).
>
> I know in WPF this is achieved using a Style for the Rectangle in the
> ItemTemplate because it is not possible to bind directly Canvas.Top
> and Canvas.Left properties. I tryied both the solutions in Silverlight
> 2.00 but I'm unable to achieve the required result due to bad exceptions
> (Memory corrupted?!?!? :S) or simply nothing displayed. It seems that the
> {Binding} extension does not work on properties inside the
> Rectangle...
>
> Here is a bit of code:
> <ItemsControl DataContext="{StaticResource ds}" ItemsSource="{BindingPlaces
> }">
>     <ItemsControl.ItemTemplate>
>         <DataTemplate>
>             <Rectangle Height="25" Width="25" RadiusX="5" RadiusY="5" Fill
> ="#31FFFFFF">
>                 <Rectangle.Style>
>                     <Style TargetType="Rectangle">
>                         <Setter Property="Canvas.Left" Value="{Binding X
> }"/>
>                         <Setter Property="Canvas.Top" Value="{Binding Y
> }"/>
>                     </Style>
>                 </Rectangle.Style>
>             </Rectangle>
>        </DataTemplate>
>     </ItemsControl.ItemTemplate>
>     <ItemsControl.ItemsPanel>
>         <ItemsPanelTemplate>
>             <Canvas />
>         </ItemsPanelTemplate>
>     </ItemsControl.ItemsPanel>
> </ItemsControl>
> I've tryied with style embedded and with style in a resource section. And
> of course I've tryied also binding directly to the Canvas.Top and
> Canvas.Left properties.
>
> Does anyone of you have never did something similar?
>
> Where's the trick?
>
> :D
>
> Bye!
>
> --
> Andrea Boschin
> Microsoft(R) MVP - [Visual Developer - ASP/ASP.NET]
> http://blog.boschin.it
> http://www.xedotnet.org
> http://mvp.support.microsoft.com/profile/Andrea.Boschin
> -------------------------------------------------------------------
> OzSilverlight.com - to unsubscribe from this list, send a message back to
> the list with 'unsubscribe' as the subject.
> Powered by mailenable.com - List managed by www.readify.net




-- 
.net noobieâ„¢

I have made a blog, but remember I am just a noobie
http://dotnetnoobie.spaces.live.com/

Now on the Gold Coast, need a worker, please contact me, thank you.



------------------------------------------------------------------- 
OzSilverlight.com - to unsubscribe from this list, send a message back to the 
list with 'unsubscribe' as the subject.

Powered by mailenable.com - List managed by www.readify.net

Reply via email to