If you run this trivial XAML program, it displays an ellipse and lets you drawon it. If you resize the window, the ink stay nicely in proportion to where it was drawn. This is all great!
Code Block
<
Window x:Class="WpfApplication4.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Viewbox>
<InkCanvas>
<InkCanvas.Background>
<DrawingBrush>
<DrawingBrush.Drawing>
<GeometryDrawing Brush="Red">
<GeometryDrawing.Geometry>
<EllipseGeometry RadiusX="9" RadiusY="5"/>
</GeometryDrawing.Geometry>
</GeometryDrawing>
</DrawingBrush.Drawing>
</DrawingBrush>
</InkCanvas.Background>
</InkCanvas>
</Viewbox>
</
Window>
Now try scribbling outside theellipse (start drawing in the ellipse and make a big sweeping loop outside the window bythe lower right corner). The ink essentially keeps collecting outside of the window and this causes the viewbox to resize everything. Is there some way to constrain the ink to only within the original bounds of the InkCanvas?
I want the viewbox so that the ellipse resizes nicely to the screen, I just don't want the inkcanvas to change sizes relative to the ellipse. I tried settingthe Width and Height of the InkCanvas and that helps but causes some other issues if I substitute an image for the ellipse (due to differences between the DPI of the image and that of the particular machine it's running on).
Is there some property I haven't found yet that controls the InkCanvas? Any other suggestions? Thanks!