开发者

WPF ToolTip containing buttons can not recieve Mouse events, alternative?

开发者 https://www.devze.com 2023-01-10 17:10 出处:网络
I want a formatbar like in Office 2010 with WPF: Select Text a开发者_JAVA百科nd then click buttons on appearing tooltip to execute a command

I want a formatbar like in Office 2010 with WPF:

How can I make that work?


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>
0

精彩评论

暂无评论...
验证码 换一张
取 消