This sample adds new vertex to a rectangle, create adding more sides for each click outside of the polygon.
View SourceCode NextStep