ToolTipPage.xaml 3.0 KB

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