Files
ShrlAlgoToolkit/AntdWpfDemo/Views/ToolTipView.xaml

124 lines
6.7 KiB
Plaintext
Raw Normal View History

2025-07-11 09:20:23 +08:00
<UserControl x:Class="AntdWpfDemo.Views.ToolTipView"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:antd="https://github.com/ShrlAlgo/AntdWpf"
mc:Ignorable="d"
d:DesignHeight="600"
d:DesignWidth="930">
<ScrollViewer>
<Grid Margin="16 0">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<StackPanel>
<Label Style="{StaticResource Ant.H1}" Content="Tooltip" />
<TextBlock Style="{StaticResource Ant.P}" Text="A simple text popup tip." />
<Label Style="{StaticResource Ant.H2}" Content="When To Use" />
<TextBlock Style="{StaticResource Ant.P}" Text="The tip is shown on mouse enter, and is hidden on mouse leave. The Tooltip doesn't support complex text or operations.&#x0a;To provide an explanation of a button/text/operation. It's often used instead of the html title attribute." />
<Label Style="{StaticResource Ant.H2}" Content="Examples" />
</StackPanel>
<Grid Grid.Row="1">
<Grid.Resources>
<Style TargetType="antd:Button">
<Setter Property="Margin" Value="8 0 0 8" />
</Style>
</Grid.Resources>
<Grid.ColumnDefinitions>
<ColumnDefinition />
<ColumnDefinition />
</Grid.ColumnDefinitions>
<StackPanel Margin="8 0">
<antd:CodeBox Title="Basic">
<antd:CodeBox.Description>
The simplest usage.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<TextBlock Text="Tooltip will show when mouse enter." ToolTip="prompt text" ToolTipService.Placement="Top" ToolTipService.ShowDuration="0" />
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntdWpf"\n\n
&lt;WrapPanel&gt;
&lt;antd:Switch IsChecked="True" /&gt;
&lt;/WrapPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
<antd:CodeBox Title="Arrow pointing at the center">
<antd:CodeBox.Description>
By specifying `arrowPointAtCenter` prop, the arrow will point to the center of the target element.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<StackPanel>
<WrapPanel>
<antd:Button Content="Align edge / 边缘对齐" />
</WrapPanel>
<WrapPanel>
<antd:Button Content="Arrow points to center / 箭头指向中心" />
</WrapPanel>
</StackPanel>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntdWpf"\n\n
&lt;WrapPanel&gt;
&lt;antd:Switch IsChecked="True" /&gt;
&lt;/WrapPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
<StackPanel Grid.Column="1" Margin="8 0">
<antd:CodeBox Title="Placement">
<antd:CodeBox.Description>
The ToolTip has 12 placements choice.
</antd:CodeBox.Description>
<antd:CodeBox.Content>
<Grid MaxWidth="335">
<Grid.RowDefinitions>
<RowDefinition />
<RowDefinition />
<RowDefinition />
</Grid.RowDefinitions>
<WrapPanel HorizontalAlignment="Center">
<antd:Button Content="TL" />
<antd:Button Content="Top" />
<antd:Button Content="TR" />
</WrapPanel>
<StackPanel Grid.Row="1" HorizontalAlignment="Left">
<antd:Button Content="LT" />
<antd:Button Content="Left" />
<antd:Button Content="LB" />
</StackPanel>
<StackPanel Grid.Row="1" HorizontalAlignment="Right">
<antd:Button Content="RT" />
<antd:Button Content="Right" />
<antd:Button Content="RB" />
</StackPanel>
<WrapPanel Grid.Row="2" HorizontalAlignment="Center">
<antd:Button Content="BL" />
<antd:Button Content="Bottom" />
<antd:Button Content="BR" />
</WrapPanel>
</Grid>
</antd:CodeBox.Content>
<antd:CodeBox.Code>
&lt;ResourceDictionary Source="pack://application:,,,/AntdWpf;component/Themes/Theme.xaml" /&gt;\n\n
xmlns:antd="https://github.com/ShrlAlgo/AntdWpf"\n\n
&lt;WrapPanel&gt;
&lt;antd:Switch IsChecked="True" /&gt;
&lt;/WrapPanel&gt;
</antd:CodeBox.Code>
</antd:CodeBox>
</StackPanel>
</Grid>
</Grid>
</ScrollViewer>
</UserControl>