这是使用 RoutedCommand 的好例子吗?
我有一个 WPF 页面,上面有 2 个 ContentControl。 两个 ContentControl 都有一个图像,其中一个比另一个小得多。 当鼠标悬停在较大图像上时,我想在较小图像上显示放大视图。 与此非常相似的东西: http://www.trekbikes.com /us/en/bikes/urban/soho/soho/。
我想我希望较大的图像控件发送实际包含图像的内容 - 较小的图像控件将拾取并显示该图像。 这是利用 RoutedCommands 的好地方吗? 我可以传递这样的图像吗?
I have a WPF page that has 2 ContentControls on it. Both of the ContentControls have an image, one being much smaller than the other. When mouse over the larger image I want to show a zoomed in view on the smaller image. Something very similar to this: http://www.trekbikes.com/us/en/bikes/urban/soho/soho/.
I think I want the larger image control to send out something that actually contains an image - which the smaller image control would pick up and display. Would this be a good place to take advantage of RoutedCommands? Can I pass along an image like that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
在这种情况下,RoatedCommands 似乎有点错位......您会希望鼠标能够平滑响应,而您最不希望的就是到处发出命令。
您最好使用 VisualBrush。 而 Ian Griffith 的示例此处是一个放大镜 ( WPF 中的早期规范 VisualBrush 示例)您可以轻松地调整它以显示图像的一部分。
RoutedCommands seem a bit misplaced in this case... you'll want the mouse to respond smoothly and the last thing you want are commands to be fired off here and there.
You're probably better off using a VisualBrush. While Ian Griffith's example here is a magnifying glass (an early canonical VisualBrush example in WPF) you could easily adapt it to show a portion of your image.