气球弹出 WPF

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/12499200/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-13 05:26:08  来源:igfitidea点击:

Balloon Popup WPF

c#wpfpopuptooltippopup-balloons

提问by Nick

I need to display a baloon popup. Is there a control in WPF for this kind of work? Something like the following:

我需要显示一个气球弹出窗口。WPF 中是否有针对此类工作的控件?类似于以下内容:

<BalloonPopup>
   <StackPanel>
      <Button/>
      . . .
   </StackPanel>
</BalloonPopup>

This is the possible result:

这是可能的结果:

enter image description here

在此处输入图片说明

回答by David Basarab

You want to do a tooltip. wpf.200things has a great write on on it.

你想做一个工具提示。wpf.200things 上写得很好。

From this article. You are basically going to style the tooltip like below

从这篇文章。你基本上要像下面这样设置工具提示的样式

<TextBox Text="Now is the winter of our discontent etc"
    Width="100" Margin="10">
    <TextBox.ToolTip>
        <ToolTip DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}">
            <StackPanel>
                <Label FontWeight="Bold" Content="Full Text"/>
                <Label Content="{Binding Text}"/>
                <Label Content="--Gloster, in Richard III (Act I, Scene I)"/>
            </StackPanel>
        </ToolTip>
    </TextBox.ToolTip> </TextBox>

回答by Freeman

Dont know if you saw this but here you can find some pretty nice examples, that helped me in the same situation.

不知道你是否看到了这个,但在这里你可以找到一些非常好的例子,它们在同样的情况下帮助了我。

How to implement Balloon message in a WPF application

如何在 WPF 应用程序中实现气球消息