ToggleSwitchPage.xaml 2.5 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980
  1. <UserControl xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. x:Class="ControlCatalog.Pages.ToggleSwitchPage" Margin="5">
  4. <StackPanel MaxWidth="500"
  5. HorizontalAlignment="Stretch">
  6. <TextBlock Text="Simple ToggleSwitch" Classes="header"/>
  7. <Border Classes="Thin">
  8. <StackPanel>
  9. <ToggleSwitch Margin="10"/>
  10. <TextBox Text="&lt;ToggleSwitch/&gt;" Classes="CodeBox"/>
  11. </StackPanel>
  12. </Border>
  13. <TextBlock Text="Headered ToggleSwitch" Classes="header"/>
  14. <Border Classes="Thin">
  15. <StackPanel>
  16. <ToggleSwitch Content="h_eadered" IsChecked="true" Margin="10"/>
  17. <TextBox Classes="CodeBox"
  18. Text="&lt;ToggleSwitch&gt;headered&lt;/ToggleSwitch&gt;"/>
  19. </StackPanel>
  20. </Border>
  21. <TextBlock Text="Custom content ToggleSwitch" Classes="header"/>
  22. <Border Classes="Thin">
  23. <StackPanel>
  24. <ToggleSwitch Content="_Custom"
  25. OnContent="On"
  26. OffContent="Off"
  27. Margin="10"/>
  28. <TextBox Text="&lt;ToggleSwitch Content=&quot;Custom&quot;
  29. ContentOn=&quot;On&quot;
  30. ContentOff=&quot;Off&quot; /&gt;"
  31. Classes="CodeBox"/>
  32. </StackPanel>
  33. </Border>
  34. <TextBlock Text="Image content ToggleSwitch" Classes="header"/>
  35. <Border Classes="Thin">
  36. <StackPanel>
  37. <ToggleSwitch Content="_Just Click!" Margin="10">
  38. <ToggleSwitch.OnContent>
  39. <Image Source="/Assets/hirsch-899118_640.jpg" Height="32"/>
  40. </ToggleSwitch.OnContent>
  41. <ToggleSwitch.OffContent>
  42. <Image Source="/Assets/delicate-arch-896885_640.jpg" Height="32"/>
  43. </ToggleSwitch.OffContent>
  44. </ToggleSwitch>
  45. </StackPanel>
  46. </Border>
  47. </StackPanel>
  48. <UserControl.Styles >
  49. <Style Selector="TextBox.CodeBox" >
  50. <Setter Property="Padding" Value="10"/>
  51. <Setter Property="IsReadOnly" Value="True"/>
  52. <Setter Property="BorderBrush" Value="Transparent"/>
  53. <Setter Property="FontSize" Value="14"/>
  54. <Setter Property="IsEnabled" Value="true"/>
  55. </Style>
  56. <Style Selector="TextBlock.header">
  57. <Setter Property="FontSize" Value="18"/>
  58. <Setter Property="Margin" Value="0 20 0 20"/>
  59. </Style>
  60. <Style Selector="Border.Thin">
  61. <Setter Property="BorderBrush" Value="Gray"/>
  62. <Setter Property="BorderThickness" Value="0.5"/>
  63. <Setter Property="CornerRadius" Value="2"/>
  64. </Style>
  65. </UserControl.Styles>
  66. </UserControl>