Friday, July 17, 2009

ZOrder (ZIndex) in Silverlight 2

The Z-Order in Silverlight is (according to a blog I read) a bit messy.

So - what you can do to set the Z-Order is to change the Canvas.ZIndexProperty. This still doesn't work though, so one guy suggests to change the Opacity directly after changing this property. In my case the original Opacity was eg. 1... then it will look like this.

(I tested it and it works for me)

iCanvas.SetValue(Canvas.ZIndexProperty, 10);
iCanvas.Opacity = 0.9;
iCanvas.Opacity = 1.0;

Wednesday, July 8, 2009

Trying to make Delegates more "clear"

I often have to go back to see how to use delegates. I don't know WHY, but I keep forgetting the fundamentals of if...

Well - basically in Class B, you will create a Delegate. Within this class u will raise an event through the delegate. This event will then have to be handled in Class A (which uses Class B)..

CLASS B

CLASS A

Tuesday, July 7, 2009

Manipulating (scale & transform) an object in Silverlight

TransformGroup transformGroup = new TransformGroup();

RotateTransform rotateTransform = new RotateTransform();
rotateTransform.Angle = 180;
transformGroup.Children.Add(rotateTransform);

ScaleTransform scaleTransform = new ScaleTransform();
scaleTransform.ScaleX = .50;
scaleTransform.ScaleY = .50;
transformGroup.Children.Add(scaleTransform);

polygon.RenderTransform = transformGroup;

A fuller example here.