SliderPage.xaml 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:sys="clr-namespace:System;assembly=netstandard"
  4. x:Class="ControlCatalog.Pages.SliderPage">
  5. <StackPanel Orientation="Vertical" Spacing="4">
  6. <TextBlock Classes="h1">Slider</TextBlock>
  7. <TextBlock Classes="h2">A control that lets the user select from a range of values by moving a Thumb control along a Track.</TextBlock>
  8. <StackPanel Orientation="Horizontal" HorizontalAlignment="Center" Margin="0 16 0 0" Spacing="16">
  9. <StackPanel Orientation="Vertical"
  10. HorizontalAlignment="Center">
  11. <Slider Value="0"
  12. Minimum="0"
  13. Maximum="100"
  14. TickFrequency="10"
  15. Width="300" />
  16. <Slider Name="CustomTickedSlider"
  17. Value="0"
  18. Minimum="0"
  19. Maximum="100"
  20. TickPlacement="BottomRight"
  21. IsSnapToTickEnabled="True"
  22. Ticks="0,20,25,40,75,100"
  23. Width="300" />
  24. <Slider Name="SliderWithTooltip"
  25. Value="0"
  26. Minimum="0"
  27. Maximum="100"
  28. Width="300">
  29. <Slider.Styles>
  30. <Style Selector="Slider /template/ Thumb">
  31. <Setter Property="ToolTip.Tip" Value="{Binding $parent[Slider].Value, Mode=OneWay, StringFormat='Value \{0:f\}'}" />
  32. <Setter Property="ToolTip.Placement" Value="Top" />
  33. <Setter Property="ToolTip.VerticalOffset" Value="-10" />
  34. <Setter Property="ToolTip.HorizontalOffset" Value="-30" />
  35. </Style>
  36. </Slider.Styles>
  37. </Slider>
  38. <Slider Value="0"
  39. Minimum="0"
  40. Maximum="100"
  41. TickFrequency="10"
  42. Width="300">
  43. <DataValidationErrors.Error>
  44. <sys:Exception />
  45. </DataValidationErrors.Error>
  46. </Slider>
  47. <Slider Value="0"
  48. IsDirectionReversed="True"
  49. Minimum="0"
  50. Maximum="100"
  51. TickFrequency="10"
  52. Width="300" />
  53. </StackPanel>
  54. <Slider Value="0"
  55. Minimum="0"
  56. Maximum="100"
  57. Orientation="Vertical"
  58. IsSnapToTickEnabled="True"
  59. TickPlacement="Outside"
  60. TickFrequency="10"
  61. Height="300"/>
  62. <Slider Value="0"
  63. IsDirectionReversed="True"
  64. Minimum="0"
  65. Maximum="100"
  66. Orientation="Vertical"
  67. IsSnapToTickEnabled="True"
  68. TickPlacement="Outside"
  69. TickFrequency="10"
  70. Height="300"/>
  71. </StackPanel>
  72. </StackPanel>
  73. </UserControl>