zoukankan      html  css  js  c++  java
  • wpf tooltip 样式自定义

     1 <Style BasedOn="{StaticResource {x:Type ToolTip}}" TargetType="ToolTip">
     2 <Setter Property="Template">
     3 <Setter.Value>
     4 <ControlTemplate TargetType="{x:Type ToolTip}">
     5 <Border Width="128"
     6 Height="98"
     7 BorderBrush="#FFDEE7F6"
     8 BorderThickness="1"
     9 CornerRadius="5">
    10 <Border.Background>
    11 <SolidColorBrush Opacity="0.8" Color="White" />
    12 </Border.Background>
    13 <Grid Margin="10,15,0,15">
    14 <Grid.RowDefinitions>
    15 <RowDefinition />
    16 <RowDefinition />
    17 <RowDefinition />
    18 </Grid.RowDefinitions>
    19 <TextBlock VerticalAlignment="Center" Text="{Binding Tag.CityName}" />
    20 <TextBlock Grid.Row="1"
    21 VerticalAlignment="Center"
    22 Text="{Binding Tag.Total, StringFormat=总量:{0} 辆}" />
    23 <TextBlock Grid.Row="2"
    24 VerticalAlignment="Center"
    25 Text="{Binding Tag.TodayCount, StringFormat=今日:{0} 辆}" />
    26 </Grid>
    27 </Border>
    28 </ControlTemplate>
    29 </Setter.Value>
    30 </Setter>
    31 </Style>
    <Path Name="HaiNan"
    Stroke="#FF113FBB"
    StrokeThickness="0.5"
    Tag="xxxxx">
    <Path.ToolTip>
    <ToolTip DataContext="{Binding Path=PlacementTarget, RelativeSource={x:Static RelativeSource.Self}}" />
    </Path.ToolTip>
    
    </Path >

    把需要传入tooltip内的值付到对象的tag对象内,然后tooltip绑定tag作为数据上下文

  • 相关阅读:
    Delphi 打印纸张选项设置参数
    Windows win32 API 类库 硬件
    delphi 打印 PDevMode 说明
    Delphi GlobalAlloc、GlobalLock、GlobalUnlock、GlobalFree 函数
    delphi 设备函数GetDeviceCaps函数
    情感分析和数据集
    深度因式分解机
    因子分解机
    功能丰富的推荐系统
    序列感知推荐系统
  • 原文地址:https://www.cnblogs.com/zsx-blog/p/7494600.html
Copyright © 2011-2022 走看看