SliderPage.xaml 2.7 KB

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