Browse Source

Fluent ToolTip style

pull/4071/head
Max Katz 6 years ago
parent
commit
5721702fad
  1. 91
      src/Avalonia.Themes.Fluent/ToolTip.xaml

91
src/Avalonia.Themes.Fluent/ToolTip.xaml

@ -1,17 +1,74 @@
<Style xmlns="https://github.com/avaloniaui" Selector="ToolTip"> <Styles xmlns="https://github.com/avaloniaui" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<Setter Property="Background" Value="{DynamicResource ThemeBackgroundBrush}"/> <Design.PreviewWith>
<Setter Property="BorderBrush" Value="{DynamicResource ThemeBorderMidBrush}"/> <Grid RowDefinitions="Auto,Auto"
<Setter Property="BorderThickness" Value="{DynamicResource ThemeBorderThickness}"/> ColumnDefinitions="Auto,Auto"
<Setter Property="Padding" Value="4,2"/> HorizontalAlignment="Center">
<Setter Property="Template"> <Border Grid.Column="0"
<ControlTemplate> Grid.Row="1"
<ContentPresenter Name="PART_ContentPresenter" Background="{DynamicResource ThemeAccentBrush}"
Background="{TemplateBinding Background}" Margin="5"
BorderBrush="{TemplateBinding BorderBrush}" Padding="50"
BorderThickness="{TemplateBinding BorderThickness}" ToolTip.Tip="Lorem ipsum dolor sit amet, consectetur adipiscing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation ullamco laboris nisi ut aliquip ex ea commodo consequat.">
ContentTemplate="{TemplateBinding ContentTemplate}" <TextBlock>Hover Here</TextBlock>
Content="{TemplateBinding Content}" </Border>
Padding="{TemplateBinding Padding}"/> <CheckBox Grid.Column="1"
</ControlTemplate> Margin="5"
</Setter> Grid.Row="0"
</Style> IsChecked="{Binding ElementName=Border, Path=(ToolTip.IsOpen)}"
Content="ToolTip Open" />
<Border Name="Border"
Grid.Column="1"
Grid.Row="1"
Background="{DynamicResource ThemeAccentBrush}"
Margin="5"
Padding="50"
ToolTip.Placement="Bottom">
<ToolTip.Tip>
<StackPanel>
<TextBlock Classes="h1">ToolTip</TextBlock>
<TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock>
</StackPanel>
</ToolTip.Tip>
<TextBlock>ToolTip bottom placement</TextBlock>
</Border>
</Grid>
</Design.PreviewWith>
<Style Selector="ToolTip">
<Setter Property="Foreground" Value="{DynamicResource ToolTipForeground}" />
<Setter Property="Background" Value="{DynamicResource ToolTipBackground}" />
<Setter Property="BorderBrush" Value="{DynamicResource ToolTipBorderBrush}" />
<Setter Property="BorderThickness" Value="{DynamicResource ToolTipBorderThemeThickness}" />
<Setter Property="FontFamily" Value="{DynamicResource ContentControlThemeFontFamily}" />
<Setter Property="FontSize" Value="{DynamicResource ToolTipContentThemeFontSize}" />
<Setter Property="Padding" Value="{DynamicResource ToolTipBorderThemePadding}" />
<Setter Property="Transitions">
<Transitions>
<DoubleTransition Property="Opacity" Duration="0:0:0.2"/>
</Transitions>
</Setter>
<Setter Property="Template">
<ControlTemplate>
<Border Name="PART_LayoutRoot"
BorderThickness="{TemplateBinding BorderThickness}"
Background="{TemplateBinding Background}"
BorderBrush="{TemplateBinding BorderBrush}"
Padding="{TemplateBinding Padding}"
CornerRadius="{DynamicResource OverlayCornerRadius}">
<ContentPresenter Name="PART_ContentPresenter"
MaxWidth="320"
Content="{TemplateBinding Content}"
ContentTemplate="{TemplateBinding ContentTemplate}"/>
</Border>
</ControlTemplate>
</Setter>
</Style>
<Style Selector="ToolTip">
<Setter Property="Opacity" Value="0"/>
</Style>
<Style Selector="ToolTip:open">
<Setter Property="Opacity" Value="1"/>
</Style>
</Styles>

Loading…
Cancel
Save