質問

I have a PathGeometry containg a single polyline, and at a fixed interval I add a new point to the line (to plot a waveform). When using the Perforator tool I can see that every time I add a point to the line, WPF marks the entire PathGeometry as 'dirty', causing the entire shape to be re-rendered.

I hoped it would only redraw the single pixel. Is there any way to accomplish that?

役に立ちましたか?

解決

The short answer is No..

WPF is correct in dirtying the entire geometry upon a change as it take into consideration a situation where current path values had changes as well.

If you break this down, you can use a list of lines instead of path.. but,
That would mean you will have to update the lines values each time the user resize your plotting area in order to keep your proportions..

So to handle this you would probably write some code that says:
"if user resized - dirty all lines"..

Another issue is when you add another line,
you might want to squeeze all your lines to fit into your plotting area,
So you would probably write some code that says:
"if new line add - dirty all lines"..

which now give path geometry behavior a 1 to 1 similarity to your mini-engine..

If you don't need to or want to handle resizings or refittings in new lines add,
Simply use a list of lines.

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top