ButtonStrip.axaml 2.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253
  1. <Styles xmlns="https://github.com/avaloniaui"
  2. xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
  3. xmlns:components="using:InABox.Avalonia.Components">
  4. <Style Selector="components|ButtonStrip">
  5. <Setter Property="Template">
  6. <ControlTemplate>
  7. <ScrollViewer VerticalScrollBarVisibility="Disabled"
  8. HorizontalScrollBarVisibility="Auto"
  9. BorderBrush="{TemplateBinding BorderBrush}"
  10. CornerRadius="{TemplateBinding CornerRadius}">
  11. <ItemsControl ItemsSource="{TemplateBinding Items}">
  12. <ItemsControl.ItemsPanel>
  13. <ItemsPanelTemplate>
  14. <StackPanel Orientation="Horizontal" Spacing="{Binding $parent[components:ButtonStrip].ItemSpacing}"/>
  15. </ItemsPanelTemplate>
  16. </ItemsControl.ItemsPanel>
  17. </ItemsControl>
  18. </ScrollViewer>
  19. </ControlTemplate>
  20. </Setter>
  21. <Setter Property="Background" Value="{DynamicResource PrsButtonBackground}"/>
  22. <Setter Property="Foreground" Value="{DynamicResource PrsButtonForeground}"/>
  23. <Setter Property="SelectedBackground" Value="{DynamicResource PrsTileBackground}"/>
  24. <Setter Property="SelectedForeground" Value="{DynamicResource PrsTileForeground}"/>
  25. </Style>
  26. <Style Selector="components|ButtonStrip components|ButtonStripItem">
  27. <Setter Property="Template">
  28. <ControlTemplate>
  29. <Button Classes="NoHover Standard"
  30. CommandParameter="{TemplateBinding}"
  31. Command="{TemplateBinding Command}"
  32. Content="{TemplateBinding Text}">
  33. <Button.Styles>
  34. <Style Selector="Button.Standard">
  35. <Setter Property="Background" Value="{TemplateBinding Background}"/>
  36. <Setter Property="Foreground" Value="{TemplateBinding Foreground}"/>
  37. <Setter Property="FontSize" Value="{DynamicResource PrsFontSizeExtraSmall}"/>
  38. <Setter Property="Margin" Value="0"/>
  39. </Style>
  40. </Button.Styles>
  41. </Button>
  42. </ControlTemplate>
  43. </Setter>
  44. </Style>
  45. <Style Selector="components|ButtonStrip > components|ButtonStripItem">
  46. <Setter Property="Background" Value="{Binding $parent[components:ButtonStrip].Background}"/>
  47. <Setter Property="Foreground" Value="{Binding $parent[components:ButtonStrip].Foreground}"/>
  48. </Style>
  49. <Style Selector="components|ButtonStrip > components|ButtonStripItem:selected">
  50. <Setter Property="Background" Value="{Binding $parent[components:ButtonStrip].SelectedBackground}"/>
  51. <Setter Property="Foreground" Value="{Binding $parent[components:ButtonStrip].SelectedForeground}"/>
  52. </Style>
  53. </Styles>