I’m making a route planner program in WPF and I need to display a map that is a graph object with tens of thousands of edges. What would be the best option for drawing these lines if I also want to interact with this map (like zooming, moving, selecting edges)? All the options I tried turned out to hova really slow rendering performance.
Share
You can use the Shape, interact with these object is particularly simple, but if you are dealing with thousands of edges I suggest to use the DrawingVisual class, a visual object that can be used to render vector graphics on the screen, and its RenderOpen method. I had a similar problem to yours and I have improved the performance of my application using DrawingContext to draw my edges.
To zoom you have to work with transformations, in particular ScaleTrasnform and apply the transformation to your panel or to your shapes.
DrawingVisual does not provide event handlig, so if with Shape you can use events to interact with edges, with DrawingVisual you need to implement Hit-Testing.