Silverlight: How can I built an overview display block for any XAML?
Posted
by Ryan Bates
on Stack Overflow
See other posts from Stack Overflow
or by Ryan Bates
Published on 2010-06-11T17:00:10Z
Indexed on
2010/06/11
17:02 UTC
Read the original article
Hit count: 270
Silverlight
|xaml
Hi all,
I am trying to create a generic "overview" control for any XAML.
A good example of the desired effect would be on Google Maps or Bing maps: The main map zooms into some content, while a small "overview" block is docked to one of the map corners, showing the user where he/she is zoomed into.
My content is all placed inside a <Canvas>
, which can then be scaled and zoomed with transforms. While the user does this kind of navigation, I would like to give them a visual indication of where they are in the larger context of the content.
I have tried to take a 'screenshot' of the XAML before the user starts navigating, i.e. create a WriteableBitmap wbImageData = new WriteableBitmap(TheCanvas, null);
and then displaying it in an Image
. Based on the user's scrolling and zooming activity, a Rectangle
displays which part of the content is currently visible in the display area.
This works OK-ish (still clunky), but the image has to be redone everytime the content changes.
Is there a simple way to create this kind of preview, or does anyone know of a component that does it?
Thanks!
© Stack Overflow or respective owner