Zooming out a grid

Hi,

If a background grid is displayed and the user zooms out, grid lines appear and disappear. This can be seen in the GoWpf Demo program’s Draggable Link demo. It has a grid in the background. Use Ctrl+mouse scroll wheel to zoom out. different lines appear and disappear or brighten and dim at different zooms.

Is there a fix for this in GoXam?

Thanks,
Bob

GoXam GridPatterns are smart in that they know what the scale is. When the scale is small enough (i.e. zoomed out far enough) for grid lines to be too close to one another, those grid lines are not drawn. This is desirable to avoid having the whole area densely covered by lots of lines. It also helps with drawing performance, which was otherwise a problem. You will notice that (all!?) design tools do this too.

The other effect that you are seeing is what the WPF rendering system is doing with very narrow lines. At scales < 1 the lines tend to be less than one pixel thick. Depending on where and how a line is drawn it may or may not be visible. You could try customizing this by specifying the GridPattern lines yourself. The default definition is in docs/GenericWPF.xaml in the GoXam installation.

Hi Walter,

The problem is the latter, “Depending on where and how a line is drawn it may or may not be visible”.

I solved it by binding the StrokeThickness to the reciprocal of the zoom via a value converter.

Thanks,
Bob