Hi,
We are using wpfDiagram as a user control in a container with its "Stretch" horizontal & vertical alignment value. For current example the size of container/diagram is "300 x 300" and diagram's "ShowGrid" property is true.
We have handled the zoom-in and zoom-out on the mouse wheel event. Following is the code for that
private void OnDiagramMouseWheel(object sender, MouseWheelEventArgs e)
{
if (e.Delta < 0)
diagram.ZoomFactor = Math.Max(10, diagram.ZoomFactor - 15);
else
diagram.ZoomFactor = Math.Min(500, diagram.ZoomFactor + 15);
}
We are facing some problem while zooming out the diagram.
1) When we zoom-out the diagram (from 100% to 10%) the size of diagram gets shrink along with its element. Mouse wheel events are handled only in the document's visible area (ruler = 300 x 300). When the diagram has zoom value 100% the document's visible area is equal to diagram's client area but when zoom(zoom-out) is set to 10%, document's visible are is reduces and most of the diagram's client area looks blank(unused space).
We are not getting the mouse wheel events on this diagram's blank client area.
Actually user has to go or place the mouse to that 10% diagram area to do zoom-in/zoom-out. How can this be avoided?
2) How can we make the size of document's visible area equal to diagram's client area so that on 10% zoom-out we should see the (visible area) Grids in whole client area?
Actually what we want that for any zoom-out value the diagram's visible area should be equal to diagram's client area i.e. if "ShowGrid" property is true then grids should be there for any zoom-out value even for negative ruler values.
The ultimate requirement is that user need not be worried about placing the mouse in the 10% visible area when it is present in diagram's client to do zoom-in/out and whole client area should be filled with the document's visible area.