ToggleSwitchPage.xaml 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879
  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 Width="500" HorizontalAlignment="Center">
  5. <TextBlock Text="Simple ToggleSwitch" Classes="header"/>
  6. <Border Classes="Thin">
  7. <StackPanel>
  8. <ToggleSwitch Margin="10"/>
  9. <TextBox Text="&lt;ToggleSwitch/&gt;" Classes="CodeBox"/>
  10. </StackPanel>
  11. </Border>
  12. <TextBlock Text="headered ToggleSwitch" Classes="header"/>
  13. <Border Classes="Thin">
  14. <StackPanel>
  15. <ToggleSwitch Content="headered" IsChecked="true" Margin="10"/>
  16. <TextBox Classes="CodeBox"
  17. Text="&lt;ToggleSwitch&gt;headered&lt;/ToggleSwitch&gt;"/>
  18. </StackPanel>
  19. </Border>
  20. <TextBlock Text="Custom content ToggleSwitch" Classes="header"/>
  21. <Border Classes="Thin">
  22. <StackPanel>
  23. <ToggleSwitch Content="Custom"
  24. OnContent="On"
  25. OffContent="Off"
  26. Margin="10"/>
  27. <TextBox Text="&lt;ToggleSwitch Content=&quot;Custom&quot;
  28. ContentOn=&quot;On&quot;
  29. ContentOff=&quot;Off&quot; /&gt;"
  30. Classes="CodeBox"/>
  31. </StackPanel>
  32. </Border>
  33. <TextBlock Text="Image content ToggleSwitch" Classes="header"/>
  34. <Border Classes="Thin">
  35. <StackPanel>
  36. <ToggleSwitch Content="Just Click!" Margin="10">
  37. <ToggleSwitch.OnContent>
  38. <Image Source="/Assets/hirsch-899118_640.jpg" Height="32"/>
  39. </ToggleSwitch.OnContent>
  40. <ToggleSwitch.OffContent>
  41. <Image Source="/Assets/delicate-arch-896885_640.jpg" Height="32"/>
  42. </ToggleSwitch.OffContent>
  43. </ToggleSwitch>
  44. </StackPanel>
  45. </Border>
  46. </StackPanel>
  47. <UserControl.Styles >
  48. <Style Selector="TextBox.CodeBox" >
  49. <Setter Property="Padding" Value="10"/>
  50. <Setter Property="IsReadOnly" Value="True"/>
  51. <Setter Property="BorderBrush" Value="Transparent"/>
  52. <Setter Property="FontSize" Value="14"/>
  53. <Setter Property="IsEnabled" Value="true"/>
  54. </Style>
  55. <Style Selector="TextBlock.header">
  56. <Setter Property="FontSize" Value="18"/>
  57. <Setter Property="Margin" Value="0 20 0 20"/>
  58. </Style>
  59. <Style Selector="Border.Thin">
  60. <Setter Property="BorderBrush" Value="Gray"/>
  61. <Setter Property="BorderThickness" Value="0.5"/>
  62. <Setter Property="CornerRadius" Value="2"/>
  63. </Style>
  64. </UserControl.Styles>
  65. </UserControl>