Dylan Slabbinck
Dylan Slabbinck

Reputation: 854

WinRT Canvas Zoom

I'm new to winRT, i'm trying to make a world map app.
I have a canvas control with a lot of path controls in it(every path control represents a country)
Now i want to make something so i can zoom in my canvas, so instead of seeing the wolrd map, i have to focus on, for example, Europe.
I think, it is easy to zoom in an image control, but an image control can't have different path controls in it.
Is there a way to make a zoom behavior or something on a canvas control?
thx in advance

Upvotes: 1

Views: 520

Answers (1)

Erwin Alva
Erwin Alva

Reputation: 393

You can try enclosing the canvas inside a ScrollViewer:

<ScrollViewer MinZoomFactor="0.25" >
    <Canvas>
        <Canvas.Background>
            <ImageBrush x:Name="_background" />
        </Canvas.Background>
    </Canvas>
</ScrollViewer>

...then you can assign an image source to the canvas (in your case, a map).

Upvotes: 1

Related Questions