Browse Source

Use resources to adjust tab background corner radius in ColorPicker

pull/8633/head
robloo 4 years ago
parent
commit
f87052311b
  1. 8
      src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml
  2. 12
      src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml

8
src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorPicker.xaml

@ -45,7 +45,6 @@
<Flyout FlyoutPresenterClasses="nopadding"
Placement="Bottom">
<ColorView x:Name="FlyoutColorView"
Classes="topoverlay"
Color="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
ColorModel="{Binding ColorModel, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
ColorSpectrumComponents="{TemplateBinding ColorSpectrumComponents}"
@ -72,7 +71,12 @@
PaletteColors="{TemplateBinding PaletteColors}"
PaletteColumnCount="{TemplateBinding PaletteColumnCount}"
Palette="{TemplateBinding Palette}"
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}" />
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
<ColorView.Resources>
<!-- This radius must follow OverlayCornerRadius -->
<CornerRadius x:Key="ColorViewTabBackgroundCornerRadius">5,5,0,0</CornerRadius>
</ColorView.Resources>
</ColorView>
</Flyout>
</DropDownButton.Flyout>
</DropDownButton>

12
src/Avalonia.Controls.ColorPicker/Themes/Fluent/ColorView.xaml

@ -77,8 +77,8 @@
17.7761 14 17.5 14H9.94999ZM7.5 16C6.67157 16 6 15.3284 6 14.5C6 13.6716 6.67157 13 7.5
13C8.32843 13 9 13.6716 9 14.5C9 15.3284 8.32843 16 7.5 16Z
</PathGeometry>
<!-- This must follow OverlayCornerRadius -->
<CornerRadius x:Key="TopOverlayCornerRadius">5,5,0,0</CornerRadius>
<!-- This radius should follow ControlCornerRadius -->
<CornerRadius x:Key="ColorViewTabBackgroundCornerRadius">3</CornerRadius>
<ControlTheme x:Key="{x:Type ColorView}"
TargetType="ColorView">
@ -99,7 +99,7 @@
HorizontalAlignment="Stretch"
VerticalAlignment="Top"
Background="{DynamicResource SystemControlBackgroundBaseLowBrush}"
CornerRadius="{TemplateBinding CornerRadius}" />
CornerRadius="{DynamicResource ColorViewTabBackgroundCornerRadius}" />
<Border x:Name="ContentBackgroundBorder"
Grid.Row="0"
Grid.RowSpan="2"
@ -646,12 +646,6 @@
</Grid>
</ControlTemplate>
</Setter>
<!-- Special style used to customize the top tab area corner radius -->
<Style Selector="^.topoverlay /template/ Border#TabBackgroundBorder">
<Setter Property="CornerRadius" Value="{DynamicResource TopOverlayCornerRadius}" />
</Style>
</ControlTheme>
</ResourceDictionary>

Loading…
Cancel
Save