How to implement minimap of workspace?
I 开发者_如何学运维use wpf 4.0.
I use canvas as workspace. It's bigger than screen. I want to create minimap of workspace for overview workspace.
How to implement minimap of workspace?
You can use RenderTargetBitmap
periodically. The documentation has an example. If your architecture supports it, you could also have two different controls bound to the same view model (one full sized one small) and then the thumbnail will update in real-time.
Using a VisualBrush is great for this. In this example, the minimap would be a Rectangle with a VisualBrush Fill, and the VisualBrush.Visual property would be set to the workspace Canvas. Updates to the VisualBrush occur automatically.
Optionally, you could adjust the VisualBrush.Viewport property to adjust how much of the workspace is seen.
精彩评论