F
Fred Mellender
I have a vertical line going from (20,0) to (20,-200):
CODE:
Line foo = new Line();
foo.X1 = 20;
foo.Y1 = 0;
foo.X2 = 20;
foo.Y2 = -200;
foo.StrokeThickness = 4;
foo.Stroke = Brushes.Black;
foo.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
Size fooSize = foo.DesiredSize;
bool valid = foo.IsMeasureValid;
RESULTS:
valid is true and
fooSize is:
fooSize.height = 0.0;
fooSize.width = 22.0 (twenty-two)
I was expecting height = 200, width = 4.
Can someone explain how else I can get the bounding box of a line (or other
UIElement), and what DesiredSize is returning?
I am trying to work in world coordinates and need the various bounding boxes
of the UIElements
that I will add to a canvas, so that I can scale the entire canvas to a
containing panel, (via a transform).
It all works well if I calculate the bounding boxes myself but I wanted
something more general.
CODE:
Line foo = new Line();
foo.X1 = 20;
foo.Y1 = 0;
foo.X2 = 20;
foo.Y2 = -200;
foo.StrokeThickness = 4;
foo.Stroke = Brushes.Black;
foo.Measure(new Size(double.PositiveInfinity, double.PositiveInfinity));
Size fooSize = foo.DesiredSize;
bool valid = foo.IsMeasureValid;
RESULTS:
valid is true and
fooSize is:
fooSize.height = 0.0;
fooSize.width = 22.0 (twenty-two)
I was expecting height = 200, width = 4.
Can someone explain how else I can get the bounding box of a line (or other
UIElement), and what DesiredSize is returning?
I am trying to work in world coordinates and need the various bounding boxes
of the UIElements
that I will add to a canvas, so that I can scale the entire canvas to a
containing panel, (via a transform).
It all works well if I calculate the bounding boxes myself but I wanted
something more general.