Zoom using mouse co-ordinates

i'm currently building a basic graph package whereby lines (and bar charts/histograms etc) are drawn. the line's are drawn via the polyline element

i am just wondering if it is possible for the user to select an area using the mouse (left clicking then dragging), and then the canvas will only display this area, then left clicking and the original screen is shown

i know it is possible in other languages but i'm not sure how to do it using xaml and c#.

any help would be really appreciated :-)

an example of my code is:

<TabControl x:Name="graphCanvas" Margin="5">
<TabControl.Items>
<TabItem Header ="Line">
<Canvas x:Name="LineCanvas" PreviewMouseMove="graphPosition">
................
</Canvas>
</TabItem>
<TabItem Header ="Bar">
<Canvas x:Name="BarCanvas" PreviewMouseMove="graphPosition">
..................
</Canvas>
</TabItem>
<TabItem Header ="PolyLine">
<Canvas x:Name="polyCanvas" PreviewMouseMove="graphPosition">
<!-- x and y Axis -->
<Line X1="80" X2="580" Y1="350" Y2="350" StrokeEndLineCap="Triangle" StrokeThickness="2"/>
<Line X1="80" X2="80" Y1="350" Y2="50" StrokeEndLineCap="Triangle" StrokeThickness="2"/>
<TextBlock Canvas.Bottom="0" Canvas.Left="300" FontSize="12"> Days of the Week </TextBlock>
<TextBlock Width="50" TextWrapping="Wrap" Canvas.Bottom="225" Canvas.Left="15" FontSize="12"> Number of Sales </TextBlock>
<Polyline x:Name="polysize1" PreviewMouseRightButtonDown="colourdown" PreviewMouseLeftButtonDown="mousedownsize" PreviewMouseLeftButtonUp="mouseupsize" Stroke="AliceBlue" StrokeThickness="2">
<Polyline.Points>
<Binding Path ="poly"/>
</Polyline.Points>
</Polyline>
<Polyline Stroke="Black" PreviewMouseRightButtonDown="colourdown" StrokeThickness="2" PreviewMouseLeftButtonDown="mousedownsize" PreviewMouseLeftButtonUp="mouseupsize" >
<Polyline.Points>
<Binding Path ="poly2"/>
</Polyline.Points>
</Polyline>
<Polyline x:Name="P3" PreviewMouseRightButtonDown="colourdown" Stroke="Blue" StrokeThickness="2" PreviewMouseLeftButtonDown="mousedownsize" PreviewMouseLeftButtonUp="mouseupsize" >
<Polyline.Points>
<Binding Path ="poly3"/>
</Polyline.Points>
</Polyline>
</Canvas>
</TabItem>
<TabItem Header="Zoom">
</TabItem>
</TabControl.Items>
</TabControl>

[3165 byte] By [SPWilkinson] at [2007-12-22]

Visual Studio Orcas

Site Classified