WPF PathGeometry rendering

I have a PathGeometry containing one polyline and at a fixed interval add a new point to the line (to draw the waveform). When using the Punch tool, I see that every time I add a point to a line, WPF marks the entire PathGeometry as dirty, causing the entire shape to re-render.

I was hoping it would only redraw one pixel. Is there a way to do this?

+3


source to share


1 answer


The short answer is: No.

WPF is good at polluting all geometry when it changes because it takes into account the situation where the current path values ​​also have changes.

If you break this, you can use a list of strings instead of a path .. but,
that would mean that you have to update the values ​​of the strings every time the user resizes the plot area to keep your aspect ratio.

So to deal with this, you probably write code that says
"if the user resizes, it pollutes all the lines."



Another problem is when you add another line,
you may want to squeeze all your lines to fit into the area of ​​your plot,
so you probably write code that says
"if a newline adds, pollutes all lines".

which now give the behavior of the geometry paths 1 to 1 similar to your mini-engine.

If you don't need or want to handle changes or additions on new lines, add,
Just use a list of lines.

+1


source







All Articles