将鼠标悬停在 Silverlight 中的对象上时显示自定义工具提示?/弹出窗口 [英] Showing custom tooltip?/Popup when hovering over an object in Silverlight

查看:17
本文介绍了将鼠标悬停在 Silverlight 中的对象上时显示自定义工具提示?/弹出窗口的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我悬停或单击 Silverlight 应用中的对象时,如何获得类似的弹出窗口/悬停/工具提示(见下图)?

How can I go about getting similar popup/hover/tooltip (see image below) when I hover or click on an object in my Silverlight app?

更新:(增加赏金)

我正在寻找一种可以放置阴影并显示箭头的控件.我想要 3-4 行数据,我可以将其作为控件的属性传入.

I am looking for a control which can drop a shadow and show the arrow. I want like 3-4 lines of data which I can pass in as the control's properties.

弹出示例 http://www.freeimagehosting.net/uploads/4a78a786fc.gif

推荐答案

Expression Blend 4 具有这种标注形状,您可以对其应用 .要将文本放入其中,只需将文本框和标注包裹在画布中即可.来自本网站:

Expression Blend 4 has this kind of callout shape and you can apply a <DropShadowEffect/> to it. To put text inside, just wrap a textbox and the callout in a canvas. From this site:

Expression Blend 4 现在包括用于轻松创建圆弧、箭头、标注和多边形的预设.形状可以在草图样式和常规样式渲染之间轻松切换.可以在新形状类别下的资产面板中找到此功能.

Expression Blend 4 now includes presets for the easy creation of arcs, arrows, callouts, and polygons. Shapes can be easily switched between sketch-style and regular-style rendering. This feature can be found in the Assets panel under the new Shapes category.

我使用了标注 - 非常方便,用法与 Office 中的自选图形非常相似.要制作弹出窗口,您只需要一个简单的动画.

I've used the callouts - very handy and very similar in usage to AutoShapes in Office. To do a pop-up, you'll just need a simple animation.

如果您没有表达式,您可以手动编写 XAML 代码以创建标注.这是我制作的一个示例:

If you don't have Expressions, you could hand-code the XAML for creating the callout. Here's an example of one that I made:

<Path x:Name="Callout" Height="218" Width="197" Stroke="Black" StrokeThickness="2" Fill="WhiteSmoke" Canvas.Top="60" Canvas.Left="53" Stretch="Fill">
    <Path.Effect>
        <DropShadowEffect ShadowDepth="50" Opacity="0.25" BlurRadius="10"  />
    </Path.Effect>
    <Path.Data>
        <PathGeometry>
          <PathGeometry.Figures>
            <PathFigure StartPoint="0 21.1" IsClosed="True">
              <PathFigure.Segments>
                <ArcSegment Point="21.1 0" Size="21.1 21.1" SweepDirection="Clockwise" />
                <LineSegment Point="31.66 0" />
                <LineSegment Point="79.14 0" />
                <LineSegment Point="168.83 0" />
                <ArcSegment Point="189.93 21.1" Size="21.1 21.1" SweepDirection="Clockwise" />
                <LineSegment Point="189.93 73.86" />
                <LineSegment Point="189.93 105.52" />
                <ArcSegment Point="168.83 126.62" Size="21.1 21.1" SweepDirection="Clockwise" />
                <LineSegment Point="79.14 126.62" />
                <LineSegment Point="30.57 213.21" />
                <LineSegment Point="31.66 126.62" />
                <LineSegment Point="21.1 126.62" />
                <ArcSegment Point="0 105.52" Size="21.1 21.1" SweepDirection="Clockwise" />
                <LineSegment Point="0 105.52" />
                <LineSegment Point="0 73.86" />
              </PathFigure.Segments>
            </PathFigure>
          </PathGeometry.Figures>
        </PathGeometry>
    </Path.Data>
</Path>

标注的尾部与示例中的尾部不完全相同,阴影也不同,但可以更改不同的值以使其看起来尽可能接近示例.

The callout's tail isn't exactly like the one in the sample and the dropshadow is also different, but different values can be changed to try to make it look as close as possible to the sample.

这篇关于将鼠标悬停在 Silverlight 中的对象上时显示自定义工具提示?/弹出窗口的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆