Does anyone know:
- Why the origin in some controls is at Center of the Bounds,in some at TopRight corner and in some at TopRight - 10px?
- How to change the origin of a Control in WPF?
Methods tried:
- For getting origin of the Control in a Canvas:
myControl.TranslatePoint(new Point(0,0),null)
; - Tried:
myControl.RenderTransformOrigin = new Point(0.0,0.0);
myControl.RenderTransformOrigin = new Point(0.5,0.5);
myControl.RenderTransformOrigin = new Point(1.0,1.0);
Tried changing VerticalAlignment and HorizontalAlignment.
Nothing Happened.
As analysis,I tried putting a Red Line in MouseMove Event which has as start Point the Canvas Origin,and as End point:
myLine.X2 = myControl.TranslatePoint(new Point(0,0),null).X;
myLine.Y2 = myControl.TranslatePoint(new Point(0,0),null).Y;
This line points in SOME CONTROLS on the Center of control,and in some other controls at the Top-Right corner,But NEVER at Top-Left.
The Alignments of ALL Controls are set to Stretch/Stretch.