How to update line annotation with new start/end points?

Question:

I am running the PDFViewWPFTestCS2013 project in the Samples_2013 solution.

I want to add controls that allow the user to explicitly set the position of an annotation (by typing in the coordinates).

What steps would I take to
(1) make this update to the annotation
(2) get the user interface to refresh/redraw so that the updated annotation is correctly displayed to reflect the update?

Answer:

For #1 you need to calculate the new rectangular area, and you need to call Line.Set[Start|End]Point as the getter returns a copy.

mAnnot.Resize(newAnnotRect); mLine.SetStartPoint(new PDFPoint(x1, y1)); mLine.SetEndPoint(new PDFPoint(x2, y2));

See the Finished() function in LineSelection.cs of the PDFViewWPFTools project.

For #2 you need to update the appearance of the Annotation, and then let PDFViewWPF to redraw

`
annot.RefreshAppearance();

mPDFView.Update();
`

This is simplified, the Finished() function in LineSelection.cs has complete solution.