WPF ToolTip containing buttons can not recieve Mou

2019-05-31 23:17发布

I want a formatbar like in Office 2010 with WPF:

  • Select Text and then click buttons on appearing tooltip to execute a command

How can I make that work?

标签: wpf tooltip
1条回答
爱情/是我丢掉的垃圾
2楼-- · 2019-05-31 23:52

The ToolTip window can't accept focus, use the Popup control instead. It's a bit more cumbersome, than a tooltip, because many useful properties are set to false by default, here is a tiny example:

<Popup x:Name="samplePopup" PopupAnimation="Fade" Placement="Mouse" AllowsTransparency="True" StaysOpen="False" >
      <Popup.Child>
         <StackPanel Margin="10" >
                <TextBlock Text="Some Text" HorizontalAlignment="Center" />

                <Button Content="Close" HorizontalAlignment="Center" />
         </StackPanel>
      </Popup.Child>
</Popup>
查看更多
登录 后发表回答