ToolTipPage.xaml 2.9 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.ToolTipPage">
  4. <StackPanel Orientation="Vertical"
  5. Spacing="4">
  6. <TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock>
  7. <Grid RowDefinitions="Auto,Auto,Auto"
  8. ColumnDefinitions="Auto,Auto"
  9. Margin="0,16,0,0"
  10. HorizontalAlignment="Center">
  11. <Border Grid.Column="0"
  12. Grid.Row="1"
  13. Background="{DynamicResource SystemAccentColor}"
  14. Margin="5"
  15. Padding="50"
  16. ToolTip.Tip="This is a ToolTip">
  17. <TextBlock>Hover Here</TextBlock>
  18. </Border>
  19. <ToggleSwitch Grid.Column="1"
  20. Margin="5"
  21. Grid.Row="0"
  22. IsChecked="{Binding ElementName=Border, Path=(ToolTip.IsOpen)}"
  23. Content="ToolTip Open" />
  24. <Border Name="Border"
  25. Grid.Column="1"
  26. Grid.Row="1"
  27. Background="{DynamicResource SystemAccentColor}"
  28. Margin="5"
  29. Padding="50"
  30. ToolTip.Placement="Bottom">
  31. <ToolTip.Tip>
  32. <StackPanel>
  33. <TextBlock Classes="h1">ToolTip</TextBlock>
  34. <TextBlock Classes="h2">A control which pops up a hint when a control is hovered</TextBlock>
  35. </StackPanel>
  36. </ToolTip.Tip>
  37. <TextBlock>ToolTip bottom placement</TextBlock>
  38. </Border>
  39. <Border Grid.Row="2"
  40. Grid.ColumnSpan="2"
  41. Background="{DynamicResource SystemAccentColor}"
  42. Margin="5"
  43. Padding="50"
  44. ToolTip.Tip="Hello"
  45. ToolTip.Placement="Top">
  46. <Border.Styles>
  47. <Style Selector="Border">
  48. <Style.Animations>
  49. <Animation Duration="0:0:2" IterationCount="Infinite">
  50. <KeyFrame KeyTime="0:0:0">
  51. <Setter Property="ToolTip.HorizontalOffset" Value="0" />
  52. <Setter Property="ToolTip.VerticalOffset" Value="-50" />
  53. </KeyFrame>
  54. <KeyFrame KeyTime="0:0:2" >
  55. <Setter Property="ToolTip.HorizontalOffset" Value="100" />
  56. <Setter Property="ToolTip.VerticalOffset" Value="50" />
  57. </KeyFrame>
  58. </Animation>
  59. </Style.Animations>
  60. </Style>
  61. </Border.Styles>
  62. <TextBlock>Moving offset</TextBlock>
  63. </Border>
  64. </Grid>
  65. </StackPanel>
  66. </UserControl>