gpt4 book ai didi

wpf - 如何像气泡一样设置WPF工具提示的样式?

转载 作者:行者123 更新时间:2023-12-03 12:28:13 25 4
gpt4 key购买 nike

我想像下面的图一样塑造我的WPF工具提示:

我该如何实现?

最佳答案

使用此代码:

<Window x:Class="WpfApplication2.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:ed="http://schemas.microsoft.com/expression/2010/drawing"
x:Name="Window"
Title="MainWindow"
Width="640"
Height="480">

<Window.Resources>

<Style x:Key="{x:Type ToolTip}" TargetType="ToolTip">
<Setter Property="OverridesDefaultStyle" Value="true" />
<Setter Property="HasDropShadow" Value="True" />
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="ToolTip">
<ed:Callout Name="Border"
Width="{TemplateBinding Width}"
Height="{TemplateBinding Height}"
MinWidth="100"
MinHeight="30"
Margin="0,0,0,50"
AnchorPoint="0,1.5"
Background="{StaticResource LightBrush}"
BorderBrush="{StaticResource SolidBorderBrush}"
BorderThickness="1"
CalloutStyle="RoundedRectangle"
Fill="#FFF4F4F5"
FontSize="14.667"
Stroke="Black">
<ContentPresenter Margin="4"
HorizontalAlignment="Left"
VerticalAlignment="Top" />
</ed:Callout>

</ControlTemplate>
</Setter.Value>
</Setter>
</Style>

</Window.Resources>
<Grid>
<Button ToolTip="Hello" />
</Grid>
这是一个开始,现在您必须玩...享受!

关于wpf - 如何像气泡一样设置WPF工具提示的样式?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/11446250/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com