Hope anyone can shed some light on this so I can use pens with dashes?
I am writing a scrollable diagram ( Panel inside ScrollViewer that implements IScrollInfo ) in WPF using DrawingVisual DataContext.Draw X. I have several thousand DrawingVisual that scroll using TranslateTransform on the Panel that places them. I implemented the grid by placing the Panel on top of it and drawing simple horizontal lines from one edge to the other using DataContext.DrawLine(pen, new Point(0, y), new Point(widthOfPanel, y)); // (note: these lines are always static, they never move).
Scrolling performance is absolutely insane (i.e. DrawingVisual is instantly drawn, and scrolling is instantly). But if I use a Pen that uses dash patterns (see below, for example) to draw grid lines, the scrolling is very jerky, and the performance seems to have been reduced 100 times (estimate). Can someone explain why this is happening and how can I solve it?
Pen example with a dash:
<Pen x:Key="PenUsingDashPatterns" Brush="Black" Thickness="1"> <Pen.DashStyle > <DashStyle Dashes="3, 3" /> </Pen.DashStyle> </Pen>
user65199
source share