I have a Canvas, to which I've added several thousand polygons.
I would like to be able to zoom in (which I'm doing via a ScaleTransform.
However I've been trying to use a Canvas.Clip as well to only draw a portion of the Canvas, but as soon as the ScaleTransform values are changed, the clipping stops working...
<Canvas Grid.Row="1" Margin="10" x:Name="cnvMain" Background="Transparent" >
<Canvas.Clip>
<RectangleGeometry x:Name="CanvasClip" Rect="0, 0, 300, 300"/>
</Canvas.Clip>
<Canvas.RenderTransform>
<ScaleTransform x:Name="CanvasScaleTransform" ScaleX="1" ScaleY="1"></ScaleTransform>
</Canvas.RenderTransform>
</Canvas>
And in my codebehind,
private void slScale_ValueChanged(object sender, RoutedPropertyChangedEventArgs<double> e)
{
CanvasScaleTransform.ScaleX = slScale.Value;
CanvasScaleTransform.ScaleY = slScale.Value;
}
Am I doing anything obviously wrong?