Re: Need to update polyline points after moving/dragging the polyline



Thanks Walter,

I realize that the point's position is relative to the container it's in,
however, I just discovered its not as 'straight-forward' as that. For
example, if I create a polyline like this:
<Polyline.Points>
<Point X="50" Y="50"></Point>
<Point X="100" Y="50"></Point>
</Polyline.Points>

and then I try to find it's position in the canvas like this:

Canvas.GetTop(myPolyline)
and
Canvas.GetLeft(myPolyline)

I will get 0,0 where I would be expecting 50,50. This is what was confusing
me. When ever I used GetTop and GetLeft I was getting incorrect
coordinates.

However, if I ALWAYS create the polyline (or any other shape or object I
assume) starting with it's top-left corner at 0,0 like this:

<Polyline.Points>
<Point X="0" Y="0"></Point>
<Point X="50" Y="0"></Point>
</Polyline.Points>

then no mater where I drag it to, I should then be able to get it's correct
position via GetTop and GetLeft.

ALSO, its interesting to note (although I dont understand it yet), if I
create the polyline like this:
<Point X="50" Y="50"></Point>
<Point X="100" Y="50"></Point>
then I can never drag it to the to the left or above that position bevause
it things that this position is the top/left corner of the container. Is
this a bug?

I have not seen this documented anywhere so it would be nice to make the
documentaion about this more visible.

As always Walter, thanks!



"Walter Wang [MSFT]" <wawang@xxxxxxxxxxxxxxxxxxxx> wrote in message
news:UaRp%23sSRHHA.2356@xxxxxxxxxxxxxxxxxxxxxxxxx
Hi moondaddy,

A Point's position is relative to its container, in this case, the
container is the Polyline. When you drag and move the Polyline on the
Canvas, the Polyline's position is also relative to the Canvas and it's
only the Polyline's position get changed, the Points in the Polyline is
not
changed.

You can verify this behavior by using following simple XAML and modify the
Canvas.Left/Top and observe the behavior:


<Canvas Name="myCanvas">
<Polyline Name="myPolyline" Canvas.Left="50" Canvas.Top="50"
Stroke="Blue" StrokeThickness="2">
<Polyline.Points>
<Point X="0" Y="0"></Point>
<Point X="100" Y="100"></Point>
</Polyline.Points>
</Polyline>

#The Layout System
http://msdn2.microsoft.com/en-us/library/ms745058.aspx#LayoutSystem_Measure_
Arrange

Sincerely,
Walter Wang (wawang@xxxxxxxxxxxxxxxxxxxx, remove 'online.')
Microsoft Online Community Support

==================================================
Get notification to my posts through email? Please refer to
http://msdn.microsoft.com/subscriptions/managednewsgroups/default.aspx#notif
ications. If you are using Outlook Express, please make sure you clear the
check box "Tools/Options/Read: Get 300 headers at a time" to see your
reply
promptly.

Note: The MSDN Managed Newsgroup support offering is for non-urgent issues
where an initial response from the community or a Microsoft Support
Engineer within 1 business day is acceptable. Please note that each follow
up response may take approximately 2 business days as the support
professional working with you may need further investigation to reach the
most efficient resolution. The offering is not appropriate for situations
that require urgent, real-time or phone-based interactions or complex
project analysis and dump analysis issues. Issues of this nature are best
handled working with a dedicated Microsoft Support Engineer by contacting
Microsoft Customer Support Services (CSS) at
http://msdn.microsoft.com/subscriptions/support/default.aspx.
==================================================

This posting is provided "AS IS" with no warranties, and confers no
rights.



.



Relevant Pages

  • RE: Need to update polyline points after moving/dragging the polyline
    ... When you drag and move the Polyline on the ... Canvas, the Polyline's position is also relative to the Canvas and it's ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.general)
  • Re: Need to update polyline points after moving/dragging the polyline
    ... When you drag and move the Polyline on the ... Canvas, the Polyline's position is also relative to the Canvas and it's ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.dotnet.general)
  • Re: Can I have a Precedence Constraint within a For Loop Container
    ... I was able to add a precedence constraint, finally, thaks a lot. ... the container and then drop it in container, ... Microsoft Online Community Support ... where an initial response from the community or a Microsoft Support ...
    (microsoft.public.sqlserver.dts)
  • Re: SSIS Execution stops on failure
    ... Did you configure it on the "data flow task" level or "Foreach ... If you set a breakpoint on the task of the ... "Break when the container receive the Onerror event". ... Microsoft Online Community Support ...
    (microsoft.public.sqlserver.dts)
  • Re: [ckrm-tech] [patch00/05]: Containers(V2)- Introduction
    ... I finally looked into your memory controller patches. ... Current cpuset feature in Linux kernel ... We use the term container to indicate a structure against which we track ... changes in kernel are minimized so as this support can ...
    (Linux-Kernel)

Loading