Balloon Popup WPF

2019-06-23 22:51发布

问题:

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

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

This is the possible result:

回答1:

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

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>


回答2:

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