mirror of
https://gitcode.com/gh_mirrors/se/Semi.Avalonia
synced 2026-04-14 21:26:34 +08:00
Compare commits
5 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
c30db80b0e | ||
|
|
9d48dbfbbb | ||
|
|
49ee1c12cc | ||
|
|
4447475f18 | ||
|
|
e53e744d1f |
2
.github/workflows/pack-nightly.yml
vendored
2
.github/workflows/pack-nightly.yml
vendored
@@ -6,7 +6,7 @@ on:
|
|||||||
Version_Prefix:
|
Version_Prefix:
|
||||||
description: 'Version Prefix'
|
description: 'Version Prefix'
|
||||||
required: true
|
required: true
|
||||||
default: '11.2.999'
|
default: '12.0.999'
|
||||||
type: string
|
type: string
|
||||||
Semi_Avalonia:
|
Semi_Avalonia:
|
||||||
description: 'Pack Semi.Avalonia'
|
description: 'Pack Semi.Avalonia'
|
||||||
|
|||||||
1
.github/workflows/pack.yml
vendored
1
.github/workflows/pack.yml
vendored
@@ -40,6 +40,7 @@ on:
|
|||||||
Semi_Avalonia_TreeDataGrid:
|
Semi_Avalonia_TreeDataGrid:
|
||||||
type: boolean
|
type: boolean
|
||||||
default: true
|
default: true
|
||||||
|
secrets: {}
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
Pack_to_NuGet:
|
Pack_to_NuGet:
|
||||||
|
|||||||
1
.github/workflows/release-tag.yml
vendored
1
.github/workflows/release-tag.yml
vendored
@@ -33,6 +33,7 @@ jobs:
|
|||||||
Semi_Avalonia_ColorPicker: ${{ inputs.Semi_Avalonia_ColorPicker }}
|
Semi_Avalonia_ColorPicker: ${{ inputs.Semi_Avalonia_ColorPicker }}
|
||||||
Semi_Avalonia_DataGrid: ${{ inputs.Semi_Avalonia_DataGrid }}
|
Semi_Avalonia_DataGrid: ${{ inputs.Semi_Avalonia_DataGrid }}
|
||||||
Semi_Avalonia_TreeDataGrid: ${{ inputs.Semi_Avalonia_TreeDataGrid }}
|
Semi_Avalonia_TreeDataGrid: ${{ inputs.Semi_Avalonia_TreeDataGrid }}
|
||||||
|
secrets: inherit
|
||||||
|
|
||||||
publish:
|
publish:
|
||||||
uses: ./.github/workflows/publish.yml
|
uses: ./.github/workflows/publish.yml
|
||||||
|
|||||||
@@ -2,80 +2,90 @@
|
|||||||
x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo"
|
x:Class="Semi.Avalonia.Demo.Pages.ColorPickerDemo"
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:semi="https://irihi.tech/semi"
|
|
||||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||||
d:DesignHeight="1450"
|
d:DesignHeight="1450"
|
||||||
d:DesignWidth="800"
|
d:DesignWidth="800"
|
||||||
mc:Ignorable="d">
|
mc:Ignorable="d">
|
||||||
<ScrollViewer>
|
<DockPanel>
|
||||||
<StackPanel Spacing="20">
|
<ScrollViewer DockPanel.Dock="Right" Width="260">
|
||||||
<StackPanel Orientation="Horizontal" Spacing="20">
|
<StackPanel Margin="12" Spacing="8">
|
||||||
<ColorView Name="Test" ColorSpectrumShape="Ring" />
|
<StackPanel.Styles>
|
||||||
<ColorView ColorSpectrumShape="Box" />
|
<Style Selector="ToggleSwitch">
|
||||||
<ColorView Palette="{DynamicResource SemiColorPalette}" />
|
<Setter Property="OffContent" Value="{Binding $self.OnContent}" />
|
||||||
</StackPanel>
|
</Style>
|
||||||
<StackPanel Orientation="Horizontal">
|
</StackPanel.Styles>
|
||||||
<ColorView
|
<StackPanel Spacing="8">
|
||||||
Name="SimpleColorViewTest"
|
<ToggleSwitch Name="AccentColors" OnContent="IsAccentColorsVisible" IsChecked="True" />
|
||||||
HsvColor="hsv(180,80%,70%)"
|
<ToggleSwitch Name="AlphaEnabled" OnContent="IsAlphaEnabled" IsChecked="True" />
|
||||||
IsAlphaVisible="True"
|
<ToggleSwitch Name="Alpha" OnContent="IsAlphaVisible" IsChecked="True" />
|
||||||
Theme="{StaticResource SimpleColorView}" />
|
<ToggleSwitch Name="ColorComponents" OnContent="IsColorComponentsVisible" IsChecked="True" />
|
||||||
<StackPanel>
|
<ToggleSwitch Name="ColorModel" OnContent="IsColorModelVisible" IsChecked="True" />
|
||||||
<TextBlock Text="{Binding #SimpleColorViewTest.HsvColor}" />
|
<ToggleSwitch Name="ColorPalette" OnContent="IsColorPaletteVisible" IsChecked="True" />
|
||||||
<TextBlock Text="{Binding #SimpleColorViewTest.Color}" />
|
<ToggleSwitch Name="ColorPreview" OnContent="IsColorPreviewVisible" IsChecked="True" />
|
||||||
|
<ToggleSwitch Name="ColorSpectrum" OnContent="IsColorSpectrumVisible" IsChecked="True" />
|
||||||
|
<ToggleSwitch Name="ColorSpectrumSlider" OnContent="IsColorSpectrumSliderVisible" IsChecked="True" />
|
||||||
|
<ToggleSwitch Name="ComponentSlider" OnContent="IsComponentSliderVisible" IsChecked="True" />
|
||||||
|
<ToggleSwitch Name="ComponentTextInput" OnContent="IsComponentTextInputVisible" IsChecked="True" />
|
||||||
|
<ToggleSwitch Name="HexInput" OnContent="IsHexInputVisible" IsChecked="True" />
|
||||||
|
</StackPanel>
|
||||||
|
|
||||||
|
<Separator />
|
||||||
|
|
||||||
|
<StackPanel Spacing="8">
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="Color: " />
|
||||||
|
<Run Text="{Binding #cv.Color,Mode=OneWay}" />
|
||||||
|
</TextBlock>
|
||||||
|
<TextBlock>
|
||||||
|
<Run Text="HsvColor:" />
|
||||||
|
<Run Text="{Binding #cv.HsvColor,Mode=OneWay}" />
|
||||||
|
</TextBlock>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
</ScrollViewer>
|
||||||
<ColorPicker ColorSpectrumShape="Ring">
|
|
||||||
<ColorPicker.Palette>
|
|
||||||
<FlatHalfColorPalette />
|
|
||||||
</ColorPicker.Palette>
|
|
||||||
</ColorPicker>
|
|
||||||
<ColorPicker ColorSpectrumShape="Box">
|
|
||||||
<ColorPicker.Palette>
|
|
||||||
<semi:SemiColorLightPalette />
|
|
||||||
</ColorPicker.Palette>
|
|
||||||
</ColorPicker>
|
|
||||||
<ColorPicker
|
|
||||||
Theme="{DynamicResource HexColorPicker}"
|
|
||||||
ColorSpectrumShape="Box">
|
|
||||||
<ColorPicker.Palette>
|
|
||||||
<semi:SemiColorLightPalette />
|
|
||||||
</ColorPicker.Palette>
|
|
||||||
</ColorPicker>
|
|
||||||
</StackPanel>
|
|
||||||
<StackPanel HorizontalAlignment="Left">
|
|
||||||
<TextBlock Text="Use Style to customize button" />
|
|
||||||
<ColorPicker
|
|
||||||
Margin="8"
|
|
||||||
MinWidth="32"
|
|
||||||
HsvColor="hsv(180,80%,70%)">
|
|
||||||
<ColorPicker.Content>
|
|
||||||
<Border
|
|
||||||
Margin="1"
|
|
||||||
Background="{Binding $parent[ColorPicker].HsvColor, Converter={StaticResource ToBrushConverter}}"
|
|
||||||
CornerRadius="1" />
|
|
||||||
</ColorPicker.Content>
|
|
||||||
<ColorPicker.Styles>
|
|
||||||
<Style Selector="DropDownButton">
|
|
||||||
<Setter Property="Padding" Value="0" />
|
|
||||||
<Style Selector="^ /template/ PathIcon">
|
|
||||||
<Setter Property="IsVisible" Value="False" />
|
|
||||||
</Style>
|
|
||||||
</Style>
|
|
||||||
</ColorPicker.Styles>
|
|
||||||
</ColorPicker>
|
|
||||||
</StackPanel>
|
|
||||||
|
|
||||||
<StackPanel Orientation="Horizontal" Spacing="8">
|
<Border Margin="12"
|
||||||
<ColorPicker
|
BorderBrush="{DynamicResource SemiColorBorder}"
|
||||||
Theme="{StaticResource SimpleColorPicker}"
|
BorderThickness="1"
|
||||||
HsvColor="hsv(180,80%,70%)" />
|
CornerRadius="6"
|
||||||
<ColorPicker
|
ClipToBounds="True">
|
||||||
Theme="{StaticResource HexSimpleColorPicker}"
|
<Border.Styles>
|
||||||
HsvColor="hsv(180,80%,70%)" />
|
<Style Selector=":is(ColorView)">
|
||||||
|
<Setter Property="IsAccentColorsVisible" Value="{Binding #AccentColors.IsChecked}" />
|
||||||
|
<Setter Property="IsAlphaEnabled" Value="{Binding #AlphaEnabled.IsChecked}" />
|
||||||
|
<Setter Property="IsAlphaVisible" Value="{Binding #Alpha.IsChecked}" />
|
||||||
|
<Setter Property="IsColorComponentsVisible" Value="{Binding #ColorComponents.IsChecked}" />
|
||||||
|
<Setter Property="IsColorModelVisible" Value="{Binding #ColorModel.IsChecked}" />
|
||||||
|
<Setter Property="IsColorPaletteVisible" Value="{Binding #ColorPalette.IsChecked}" />
|
||||||
|
<Setter Property="IsColorPreviewVisible" Value="{Binding #ColorPreview.IsChecked}" />
|
||||||
|
<Setter Property="IsColorSpectrumVisible" Value="{Binding #ColorSpectrum.IsChecked}" />
|
||||||
|
<Setter Property="IsColorSpectrumSliderVisible" Value="{Binding #ColorSpectrumSlider.IsChecked}" />
|
||||||
|
<Setter Property="IsComponentSliderVisible" Value="{Binding #ComponentSlider.IsChecked}" />
|
||||||
|
<Setter Property="IsComponentTextInputVisible" Value="{Binding #ComponentTextInput.IsChecked}" />
|
||||||
|
<Setter Property="IsHexInputVisible" Value="{Binding #HexInput.IsChecked}" />
|
||||||
|
|
||||||
|
<Setter Property="Color" Value="#39C5BB" />
|
||||||
|
</Style>
|
||||||
|
</Border.Styles>
|
||||||
|
<StackPanel Margin="12" Spacing="12" Orientation="Horizontal">
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<TextBlock Text="Default Theme" FontWeight="Bold" FontSize="16" />
|
||||||
|
<ColorView Name="cv" />
|
||||||
|
<StackPanel Spacing="12" Orientation="Horizontal">
|
||||||
|
<ColorPicker />
|
||||||
|
<ColorPicker Theme="{DynamicResource HexColorPicker}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
|
<StackPanel Spacing="12">
|
||||||
|
<TextBlock Text="SimpleColorPicker" FontWeight="Bold" FontSize="16" />
|
||||||
|
<ColorView Theme="{DynamicResource SimpleColorView}" />
|
||||||
|
<StackPanel Spacing="12" Orientation="Horizontal">
|
||||||
|
<ColorPicker Theme="{DynamicResource SimpleColorPicker}" />
|
||||||
|
<ColorPicker Theme="{DynamicResource HexSimpleColorPicker}" />
|
||||||
|
</StackPanel>
|
||||||
|
</StackPanel>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</StackPanel>
|
</Border>
|
||||||
</ScrollViewer>
|
</DockPanel>
|
||||||
</UserControl>
|
</UserControl>
|
||||||
@@ -50,7 +50,7 @@
|
|||||||
<TabbedPage Name="DemoTabs"
|
<TabbedPage Name="DemoTabs"
|
||||||
TabPlacement="Top"
|
TabPlacement="Top"
|
||||||
SelectionChanged="OnSelectionChanged">
|
SelectionChanged="OnSelectionChanged">
|
||||||
<ContentPage Header="Home">
|
<ContentPage Icon="{DynamicResource SemiIconHome}" Header="Home">
|
||||||
<StackPanel Margin="16" Spacing="8">
|
<StackPanel Margin="16" Spacing="8">
|
||||||
<TextBlock Text="Home Tab" FontSize="24" FontWeight="Bold" />
|
<TextBlock Text="Home Tab" FontSize="24" FontWeight="Bold" />
|
||||||
<TextBlock Text="Welcome to the Home tab. This is a TabbedPage sample."
|
<TextBlock Text="Welcome to the Home tab. This is a TabbedPage sample."
|
||||||
@@ -59,14 +59,14 @@
|
|||||||
TextWrapping="Wrap" Opacity="0.7" />
|
TextWrapping="Wrap" Opacity="0.7" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
<ContentPage Header="Search">
|
<ContentPage Icon="{DynamicResource SemiIconSearch}" Header="Search">
|
||||||
<StackPanel Margin="16" Spacing="8">
|
<StackPanel Margin="16" Spacing="8">
|
||||||
<TextBlock Text="Search Tab" FontSize="24" FontWeight="Bold" />
|
<TextBlock Text="Search Tab" FontSize="24" FontWeight="Bold" />
|
||||||
<TextBox PlaceholderText="Type to search..." />
|
<TextBox PlaceholderText="Type to search..." />
|
||||||
<TextBlock Text="Search results will appear here." Opacity="0.7" />
|
<TextBlock Text="Search results will appear here." Opacity="0.7" />
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
</ContentPage>
|
</ContentPage>
|
||||||
<ContentPage Header="Settings">
|
<ContentPage Icon="{DynamicResource SemiIconSetting}" Header="Settings">
|
||||||
<StackPanel Margin="16" Spacing="8">
|
<StackPanel Margin="16" Spacing="8">
|
||||||
<TextBlock Text="Settings Tab" FontSize="24" FontWeight="Bold" />
|
<TextBlock Text="Settings Tab" FontSize="24" FontWeight="Bold" />
|
||||||
<CheckBox Content="Enable notifications" />
|
<CheckBox Content="Enable notifications" />
|
||||||
|
|||||||
@@ -2,38 +2,48 @@
|
|||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:iri="https://irihi.tech/shared"
|
xmlns:iri="https://irihi.tech/shared"
|
||||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
xmlns:semi="https://irihi.tech/semi">
|
||||||
<converters:ToBrushConverter x:Key="ToBrushConverter" />
|
<Design.PreviewWith>
|
||||||
|
<StackPanel Width="500" Height="500">
|
||||||
|
<ColorPicker Name="cp" Color="#AAAAAAAA" IsAlphaVisible="True" IsAlphaEnabled="True" />
|
||||||
|
<ColorPicker Theme="{DynamicResource SimpleColorPicker}" Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
|
||||||
|
<ColorPicker Theme="{DynamicResource HexSimpleColorPicker}" Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
|
||||||
|
<ColorView Color="{Binding #cp.Color}" IsAlphaEnabled="{Binding #cp.IsAlphaEnabled}" IsAlphaVisible="{Binding #cp.IsAlphaVisible}" />
|
||||||
|
</StackPanel>
|
||||||
|
</Design.PreviewWith>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
|
<ControlTheme x:Key="{x:Type ColorPicker}" TargetType="ColorPicker">
|
||||||
<Setter Property="MinWidth" Value="64" />
|
<!-- Alpha position should match CSS (and default slider order) instead of XAML/WinUI -->
|
||||||
|
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
|
||||||
<Setter Property="HorizontalAlignment" Value="Center" />
|
<Setter Property="HorizontalAlignment" Value="Center" />
|
||||||
|
<Setter Property="Padding" Value="0 0 10 0" />
|
||||||
<Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" />
|
<Setter Property="MinHeight" Value="{DynamicResource ColorPickerMinHeight}" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ColorPickerCornerRadius}" />
|
||||||
|
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" />
|
||||||
<Setter Property="Content">
|
<Setter Property="Content">
|
||||||
<Template>
|
<Template>
|
||||||
<Panel>
|
<Panel>
|
||||||
<Border
|
<Border
|
||||||
Margin="1,1,0,1"
|
Margin="1,1,0,1"
|
||||||
|
Width="{Binding $self.Bounds.Height}"
|
||||||
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
|
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
|
||||||
<Border
|
<Border
|
||||||
Margin="1,1,0,1"
|
Margin="1,1,0,1"
|
||||||
|
Width="{Binding $self.Bounds.Height}"
|
||||||
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
|
Background="{TemplateBinding HsvColor, Converter={StaticResource ToBrushConverter}}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
|
CornerRadius="{TemplateBinding CornerRadius, Converter={iri:CornerRadiusMixerConverter Left}}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</Template>
|
</Template>
|
||||||
</Setter>
|
</Setter>
|
||||||
<Setter Property="Palette">
|
|
||||||
<FluentColorPalette />
|
|
||||||
</Setter>
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorPicker}">
|
<ControlTemplate TargetType="ColorPicker">
|
||||||
<DropDownButton
|
<DropDownButton
|
||||||
Width="{TemplateBinding Width}"
|
Width="{TemplateBinding Width}"
|
||||||
Height="{TemplateBinding Height}"
|
Height="{TemplateBinding Height}"
|
||||||
MinWidth="{TemplateBinding MinWidth}"
|
MinWidth="{TemplateBinding MinWidth}"
|
||||||
MinHeight="{TemplateBinding MinHeight}"
|
MinHeight="{TemplateBinding MinHeight}"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
@@ -49,7 +59,9 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</DropDownButton.Styles>
|
</DropDownButton.Styles>
|
||||||
<DropDownButton.Flyout>
|
<DropDownButton.Flyout>
|
||||||
<Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource ColorPickerFlyoutPlacement}">
|
<Flyout
|
||||||
|
FlyoutPresenterClasses="nopadding"
|
||||||
|
Placement="{DynamicResource ColorPickerFlyoutPlacement}">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The following is copy-pasted from the ColorView's control template.
|
The following is copy-pasted from the ColorView's control template.
|
||||||
@@ -57,7 +69,6 @@
|
|||||||
Note the only changes are resources specific to the ColorPicker.
|
Note the only changes are resources specific to the ColorPicker.
|
||||||
-->
|
-->
|
||||||
<Grid
|
<Grid
|
||||||
Name="RootGrid"
|
|
||||||
Width="300"
|
Width="300"
|
||||||
Height="300"
|
Height="300"
|
||||||
RowDefinitions="*,Auto">
|
RowDefinitions="*,Auto">
|
||||||
@@ -81,7 +92,7 @@
|
|||||||
Padding="0"
|
Padding="0"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
|
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
|
||||||
<TabControl.Styles>
|
<TabControl.Styles>
|
||||||
<Style Selector="TabItem">
|
<Style Selector="TabItem">
|
||||||
<Setter Property="MinHeight" Value="32" />
|
<Setter Property="MinHeight" Value="32" />
|
||||||
@@ -116,11 +127,11 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
AutomationProperties.Name="Third Component"
|
AutomationProperties.Name="Third Component"
|
||||||
ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
|
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
|
||||||
ColorModel="Hsva"
|
ColorModel="Hsva"
|
||||||
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
|
HsvColor="{Binding #ColorSpectrum.HsvColor}"
|
||||||
IsAlphaVisible="True"
|
IsAlphaVisible="False"
|
||||||
IsPerceptive="False"
|
IsPerceptive="True"
|
||||||
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
||||||
Orientation="Vertical" />
|
Orientation="Vertical" />
|
||||||
<ColorSpectrum
|
<ColorSpectrum
|
||||||
@@ -129,7 +140,7 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Components="{TemplateBinding ColorSpectrumComponents}"
|
Components="{TemplateBinding ColorSpectrumComponents}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
MaxHue="{TemplateBinding MaxHue}"
|
MaxHue="{TemplateBinding MaxHue}"
|
||||||
MaxSaturation="{TemplateBinding MaxSaturation}"
|
MaxSaturation="{TemplateBinding MaxSaturation}"
|
||||||
MaxValue="{TemplateBinding MaxValue}"
|
MaxValue="{TemplateBinding MaxValue}"
|
||||||
@@ -146,14 +157,10 @@
|
|||||||
AutomationProperties.Name="Alpha Component"
|
AutomationProperties.Name="Alpha Component"
|
||||||
ColorComponent="Alpha"
|
ColorComponent="Alpha"
|
||||||
ColorModel="Hsva"
|
ColorModel="Hsva"
|
||||||
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
|
HsvColor="{Binding #ColorSpectrum.HsvColor}"
|
||||||
|
IsVisible="{TemplateBinding IsAlphaVisible}"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
Orientation="Vertical">
|
Orientation="Vertical">
|
||||||
<ColorSlider.IsVisible>
|
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
|
||||||
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
||||||
</MultiBinding>
|
|
||||||
</ColorSlider.IsVisible>
|
|
||||||
</ColorSlider>
|
</ColorSlider>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -168,13 +175,13 @@
|
|||||||
<ListBox
|
<ListBox
|
||||||
Margin="12"
|
Margin="12"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
ItemContainerTheme="{DynamicResource ColorViewPaletteListBoxItemTheme}"
|
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
|
||||||
ItemsSource="{TemplateBinding PaletteColors}"
|
ItemsSource="{TemplateBinding PaletteColors}"
|
||||||
SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
|
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}"
|
||||||
Theme="{DynamicResource ColorViewPaletteListBoxTheme}"
|
Theme="{StaticResource ColorViewPaletteListBoxTheme}"
|
||||||
UseLayoutRounding="False">
|
UseLayoutRounding="False">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type Color}">
|
<DataTemplate DataType="Color">
|
||||||
<Border
|
<Border
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
@@ -205,7 +212,11 @@
|
|||||||
Margin="12"
|
Margin="12"
|
||||||
ColumnDefinitions="Auto,*"
|
ColumnDefinitions="Auto,*"
|
||||||
RowDefinitions="Auto,24,*,*,*,*,12"
|
RowDefinitions="Auto,24,*,*,*,*,12"
|
||||||
Tag="{TemplateBinding ColorModel}">
|
UseLayoutRounding="False">
|
||||||
|
<Grid.Resources>
|
||||||
|
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
|
||||||
|
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
|
||||||
|
</Grid.Resources>
|
||||||
<Grid.Styles>
|
<Grid.Styles>
|
||||||
<Style Selector="NumericUpDown">
|
<Style Selector="NumericUpDown">
|
||||||
<Setter Property="InnerLeftContent">
|
<Setter Property="InnerLeftContent">
|
||||||
@@ -214,34 +225,6 @@
|
|||||||
</Template>
|
</Template>
|
||||||
</Setter>
|
</Setter>
|
||||||
</Style>
|
</Style>
|
||||||
<Style Selector="Grid[Tag=Rgba]">
|
|
||||||
<Style Selector="^ NumericUpDown#Component1NumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="R" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^ NumericUpDown#Component2NumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="G" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^ NumericUpDown#Component3NumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="B" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^ NumericUpDown#AlphaComponentNumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="A" />
|
|
||||||
</Style>
|
|
||||||
</Style>
|
|
||||||
<Style Selector="Grid[Tag=Hsva]">
|
|
||||||
<Style Selector="^ NumericUpDown#Component1NumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="H" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^ NumericUpDown#Component2NumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="S" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^ NumericUpDown#Component3NumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="V" />
|
|
||||||
</Style>
|
|
||||||
<Style Selector="^ NumericUpDown#AlphaComponentNumericUpDown">
|
|
||||||
<Setter Property="Tag" Value="A" />
|
|
||||||
</Style>
|
|
||||||
</Style>
|
|
||||||
</Grid.Styles>
|
</Grid.Styles>
|
||||||
<!-- Top color model & Hex input -->
|
<!-- Top color model & Hex input -->
|
||||||
<Grid
|
<Grid
|
||||||
@@ -263,9 +246,9 @@
|
|||||||
Content="RGB"
|
Content="RGB"
|
||||||
CornerRadius="3,0,0,3"
|
CornerRadius="3,0,0,3"
|
||||||
IsChecked="{TemplateBinding ColorModel,
|
IsChecked="{TemplateBinding ColorModel,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={StaticResource EnumToBoolConverter},
|
||||||
ConverterParameter={x:Static ColorModel.Rgba},
|
ConverterParameter={x:Static ColorModel.Rgba},
|
||||||
Mode=TwoWay}"
|
Mode=TwoWay}"
|
||||||
Theme="{DynamicResource ColorViewRadioButton}" />
|
Theme="{DynamicResource ColorViewRadioButton}" />
|
||||||
<RadioButton
|
<RadioButton
|
||||||
Name="HsvRadioButton"
|
Name="HsvRadioButton"
|
||||||
@@ -275,9 +258,9 @@
|
|||||||
Content="HSV"
|
Content="HSV"
|
||||||
CornerRadius="0,3,3,0"
|
CornerRadius="0,3,3,0"
|
||||||
IsChecked="{TemplateBinding ColorModel,
|
IsChecked="{TemplateBinding ColorModel,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={StaticResource EnumToBoolConverter},
|
||||||
ConverterParameter={x:Static ColorModel.Hsva},
|
ConverterParameter={x:Static ColorModel.Hsva},
|
||||||
Mode=TwoWay}"
|
Mode=TwoWay}"
|
||||||
Theme="{DynamicResource ColorViewRadioButton}" />
|
Theme="{DynamicResource ColorViewRadioButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -302,11 +285,11 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
||||||
Maximum="{Binding Maximum, ElementName=Component1Slider}"
|
Maximum="{Binding #Component1Slider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=Component1Slider}"
|
Minimum="{Binding #Component1Slider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component1Slider}" />
|
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
|
||||||
<ColorSlider
|
<ColorSlider
|
||||||
Name="Component1Slider"
|
Name="Component1Slider"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
@@ -315,7 +298,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Component1"
|
ColorComponent="Component1"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
||||||
@@ -332,11 +315,11 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
||||||
Maximum="{Binding Maximum, ElementName=Component2Slider}"
|
Maximum="{Binding #Component2Slider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=Component2Slider}"
|
Minimum="{Binding #Component2Slider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component2Slider}" />
|
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
|
||||||
<ColorSlider
|
<ColorSlider
|
||||||
Name="Component2Slider"
|
Name="Component2Slider"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
@@ -345,7 +328,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Component2"
|
ColorComponent="Component2"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
||||||
@@ -362,11 +345,11 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
||||||
Maximum="{Binding Maximum, ElementName=Component3Slider}"
|
Maximum="{Binding #Component3Slider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=Component3Slider}"
|
Minimum="{Binding #Component3Slider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component3Slider}" />
|
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
|
||||||
<ColorSlider
|
<ColorSlider
|
||||||
Name="Component3Slider"
|
Name="Component3Slider"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
@@ -375,7 +358,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Component3"
|
ColorComponent="Component3"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
||||||
@@ -392,15 +375,15 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
|
Maximum="{Binding #AlphaComponentSlider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
|
Minimum="{Binding #AlphaComponentSlider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=AlphaComponentSlider}">
|
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
|
||||||
<NumericUpDown.IsVisible>
|
<NumericUpDown.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsAlphaVisible" />
|
||||||
<Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsComponentTextInputVisible" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</NumericUpDown.IsVisible>
|
</NumericUpDown.IsVisible>
|
||||||
</NumericUpDown>
|
</NumericUpDown>
|
||||||
@@ -412,7 +395,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Alpha"
|
ColorComponent="Alpha"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
@@ -420,8 +403,8 @@
|
|||||||
TickFrequency="1">
|
TickFrequency="1">
|
||||||
<ColorSlider.IsVisible>
|
<ColorSlider.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsAlphaVisible" />
|
||||||
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsComponentSliderVisible" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</ColorSlider.IsVisible>
|
</ColorSlider.IsVisible>
|
||||||
</ColorSlider>
|
</ColorSlider>
|
||||||
@@ -429,11 +412,11 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
<!-- Previewer -->
|
<!-- Previewer -->
|
||||||
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
|
<!-- Note that the drop shadow is allowed to extend past the control bounds -->
|
||||||
<ColorPreviewer
|
<ColorPreviewer
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="12,-5,12,7"
|
Margin="12,0,12,12"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
|
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
|
||||||
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
|
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -442,9 +425,33 @@
|
|||||||
</DropDownButton>
|
</DropDownButton>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
<Style Selector="^[ColorModel=Rgba]">
|
||||||
<Style Selector="^ /template/ DropDownButton">
|
<Style Selector="^ /template/ NumericUpDown#Component1NumericUpDown">
|
||||||
<Setter Property="Padding" Value="0 0 10 0" />
|
<Setter Property="Tag" Value="R" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^ /template/ NumericUpDown#Component2NumericUpDown">
|
||||||
|
<Setter Property="Tag" Value="G" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^ /template/ NumericUpDown#Component3NumericUpDown">
|
||||||
|
<Setter Property="Tag" Value="B" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^ /template/ NumericUpDown#AlphaComponentNumericUpDown">
|
||||||
|
<Setter Property="Tag" Value="A" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^[ColorModel=Hsva]">
|
||||||
|
<Style Selector="^ /template/ NumericUpDown#Component1NumericUpDown">
|
||||||
|
<Setter Property="Tag" Value="H" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^ /template/ NumericUpDown#Component2NumericUpDown">
|
||||||
|
<Setter Property="Tag" Value="S" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^ /template/ NumericUpDown#Component3NumericUpDown">
|
||||||
|
<Setter Property="Tag" Value="V" />
|
||||||
|
</Style>
|
||||||
|
<Style Selector="^ /template/ NumericUpDown#AlphaComponentNumericUpDown">
|
||||||
|
<Setter Property="Tag" Value="A" />
|
||||||
|
</Style>
|
||||||
</Style>
|
</Style>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
@@ -452,38 +459,34 @@
|
|||||||
x:Key="HexColorPicker"
|
x:Key="HexColorPicker"
|
||||||
BasedOn="{StaticResource {x:Type ColorPicker}}"
|
BasedOn="{StaticResource {x:Type ColorPicker}}"
|
||||||
TargetType="ColorPicker">
|
TargetType="ColorPicker">
|
||||||
<Setter Property="MinWidth" Value="200" />
|
<Setter Property="MinWidth" Value="180" />
|
||||||
<Setter Property="Content">
|
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" />
|
||||||
<Template>
|
|
||||||
<Grid ColumnDefinitions="Auto, *">
|
|
||||||
<Border
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="{Binding $self.Bounds.Height}"
|
|
||||||
Margin="1,1,0,1"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
||||||
<Border
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="{Binding $self.Bounds.Height}"
|
|
||||||
Margin="1,1,0,1"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
||||||
<TextBlock
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="8,0,0,0"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
FontWeight="Regular"
|
|
||||||
Foreground="{DynamicResource TextBlockDefaultForeground}"
|
|
||||||
Text="{Binding $parent[ColorPicker].Color}" />
|
|
||||||
</Grid>
|
|
||||||
</Template>
|
|
||||||
</Setter>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
<Template x:Key="HexColorPickerTemplate">
|
||||||
|
<Grid ColumnDefinitions="Auto, *">
|
||||||
|
<Border
|
||||||
|
Grid.Column="0"
|
||||||
|
Width="{Binding $self.Bounds.Height}"
|
||||||
|
Margin="1,1,0,1"
|
||||||
|
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
||||||
|
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" />
|
||||||
|
<Border
|
||||||
|
Grid.Column="0"
|
||||||
|
Width="{Binding $self.Bounds.Height}"
|
||||||
|
Margin="1,1,0,1"
|
||||||
|
Background="{Binding $parent[ColorPicker].HsvColor,Converter={StaticResource ToBrushConverter}}"
|
||||||
|
CornerRadius="{Binding $parent[ColorPicker].CornerRadius}" />
|
||||||
|
<TextBlock
|
||||||
|
Grid.Column="1"
|
||||||
|
Margin="8,0,0,0"
|
||||||
|
HorizontalAlignment="Left"
|
||||||
|
VerticalAlignment="Center"
|
||||||
|
Foreground="{DynamicResource TextBlockDefaultForeground}">
|
||||||
|
<Run Text="#" />
|
||||||
|
<Run Text="{Binding $parent[ColorPicker].Color, Converter={StaticResource ColorToHexConverter}}" />
|
||||||
|
</TextBlock>
|
||||||
|
</Grid>
|
||||||
|
</Template>
|
||||||
|
|
||||||
<ControlTheme
|
<ControlTheme
|
||||||
x:Key="SimpleColorPicker"
|
x:Key="SimpleColorPicker"
|
||||||
@@ -491,12 +494,13 @@
|
|||||||
TargetType="ColorPicker">
|
TargetType="ColorPicker">
|
||||||
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
|
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorPicker}">
|
<ControlTemplate TargetType="ColorPicker">
|
||||||
<DropDownButton
|
<DropDownButton
|
||||||
Width="{TemplateBinding Width}"
|
Width="{TemplateBinding Width}"
|
||||||
Height="{TemplateBinding Height}"
|
Height="{TemplateBinding Height}"
|
||||||
MinWidth="{TemplateBinding MinWidth}"
|
MinWidth="{TemplateBinding MinWidth}"
|
||||||
MinHeight="{TemplateBinding MinHeight}"
|
MinHeight="{TemplateBinding MinHeight}"
|
||||||
|
Padding="{TemplateBinding Padding}"
|
||||||
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
HorizontalAlignment="{TemplateBinding HorizontalAlignment}"
|
||||||
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
VerticalAlignment="{TemplateBinding VerticalAlignment}"
|
||||||
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
HorizontalContentAlignment="{TemplateBinding HorizontalContentAlignment}"
|
||||||
@@ -511,14 +515,16 @@
|
|||||||
</Style>
|
</Style>
|
||||||
</DropDownButton.Styles>
|
</DropDownButton.Styles>
|
||||||
<DropDownButton.Flyout>
|
<DropDownButton.Flyout>
|
||||||
<Flyout FlyoutPresenterClasses="nopadding" Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
|
<Flyout
|
||||||
|
FlyoutPresenterClasses="nopadding"
|
||||||
|
Placement="{DynamicResource SimpleColorPickerFlyoutPlacement}">
|
||||||
|
|
||||||
<!--
|
<!--
|
||||||
The following is copy-pasted from the ColorView's control template.
|
The following is copy-pasted from the ColorView's control template.
|
||||||
It MUST always be kept in sync with the ColorView (which is master).
|
It MUST always be kept in sync with the ColorView (which is master).
|
||||||
Note the only changes are resources specific to the ColorPicker.
|
Note the only changes are resources specific to the ColorPicker.
|
||||||
-->
|
-->
|
||||||
<Grid Width="280">
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" MinHeight="280" />
|
<RowDefinition Height="*" MinHeight="280" />
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@@ -534,6 +540,7 @@
|
|||||||
Name="ColorSpectrum"
|
Name="ColorSpectrum"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
|
CornerRadius="8 8 0 0"
|
||||||
Components="{TemplateBinding ColorSpectrumComponents}"
|
Components="{TemplateBinding ColorSpectrumComponents}"
|
||||||
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
MaxHue="{TemplateBinding MaxHue}"
|
MaxHue="{TemplateBinding MaxHue}"
|
||||||
@@ -584,35 +591,43 @@
|
|||||||
CornerRadius="4" />
|
CornerRadius="4" />
|
||||||
<Panel
|
<Panel
|
||||||
Name="PART_TextBoxPanel"
|
Name="PART_TextBoxPanel"
|
||||||
Width="106"
|
Width="116"
|
||||||
Margin="4 0 0 0"
|
Margin="4 0 0 0"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_HexTextBox"
|
Name="PART_HexTextBox"
|
||||||
|
AutomationProperties.Name="Hexadecimal Color"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
|
CornerRadius="3 0 0 3"
|
||||||
InnerLeftContent="#"
|
InnerLeftContent="#"
|
||||||
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
|
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}"
|
||||||
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
|
MaxLength="8">
|
||||||
MaxLength="8" />
|
<TextBox.Resources>
|
||||||
|
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
|
||||||
|
</TextBox.Resources>
|
||||||
|
</TextBox>
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_RgbaTextBox"
|
Name="PART_RgbaTextBox"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
|
CornerRadius="3 0 0 3"
|
||||||
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
|
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}"
|
||||||
|
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_HsvaTextBox"
|
Name="PART_HsvaTextBox"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
|
CornerRadius="3 0 0 3"
|
||||||
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
|
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}"
|
||||||
|
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
||||||
<NumericUpDown
|
<NumericUpDown
|
||||||
Name="AlphaComponentNumericUpDown"
|
Name="AlphaComponentNumericUpDown"
|
||||||
Width="70"
|
Width="60"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
|
CornerRadius="0"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
|
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
|
||||||
@@ -621,14 +636,21 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
InnerRightContent="%"
|
InnerRightContent="%"
|
||||||
IsVisible="{TemplateBinding IsAlphaVisible}"
|
IsVisible="{TemplateBinding IsAlphaVisible}"
|
||||||
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
|
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
|
||||||
|
<NumericUpDown.Resources>
|
||||||
|
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
|
||||||
|
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
|
||||||
|
</NumericUpDown.Resources>
|
||||||
|
</NumericUpDown>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
Name="ColorModelComboBox"
|
Name="ColorModelComboBox"
|
||||||
Width="80"
|
Width="80"
|
||||||
|
CornerRadius="0 3 3 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
SelectedValue="Hex">
|
SelectedValue="Hex">
|
||||||
Hex<ColorModel>Rgba</ColorModel>
|
<x:String>Hex</x:String>
|
||||||
|
<ColorModel>Rgba</ColorModel>
|
||||||
<ColorModel>Hsva</ColorModel>
|
<ColorModel>Hsva</ColorModel>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
@@ -647,37 +669,8 @@
|
|||||||
x:Key="HexSimpleColorPicker"
|
x:Key="HexSimpleColorPicker"
|
||||||
BasedOn="{StaticResource SimpleColorPicker}"
|
BasedOn="{StaticResource SimpleColorPicker}"
|
||||||
TargetType="ColorPicker">
|
TargetType="ColorPicker">
|
||||||
<Setter Property="MinWidth" Value="200" />
|
<Setter Property="MinWidth" Value="180" />
|
||||||
<Setter Property="Content">
|
<Setter Property="Content" Value="{StaticResource HexColorPickerTemplate}" />
|
||||||
<Template>
|
|
||||||
<Grid ColumnDefinitions="Auto, *">
|
|
||||||
<Border
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="{Binding $self.Bounds.Height}"
|
|
||||||
Margin="1,1,0,1"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Background="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
||||||
<Border
|
|
||||||
Grid.Column="0"
|
|
||||||
Width="{Binding $self.Bounds.Height}"
|
|
||||||
Margin="1,1,0,1"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
|
||||||
Background="{TemplateBinding HsvColor,Converter={StaticResource ToBrushConverter}}"
|
|
||||||
CornerRadius="{TemplateBinding CornerRadius}" />
|
|
||||||
<TextBlock
|
|
||||||
Grid.Column="1"
|
|
||||||
Margin="8,0,0,0"
|
|
||||||
HorizontalAlignment="Left"
|
|
||||||
VerticalAlignment="Center"
|
|
||||||
FontWeight="Regular"
|
|
||||||
Foreground="{DynamicResource TextBlockDefaultForeground}"
|
|
||||||
Text="{Binding $parent[ColorPicker].Color}" />
|
|
||||||
</Grid>
|
|
||||||
</Template>
|
|
||||||
</Setter>
|
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
</ResourceDictionary>
|
</ResourceDictionary>
|
||||||
@@ -1,15 +1,13 @@
|
|||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:iri="https://irihi.tech/shared"
|
xmlns:iri="https://irihi.tech/shared">
|
||||||
xmlns:pc="using:Avalonia.Controls.Primitives.Converters">
|
|
||||||
<pc:AccentColorConverter x:Key="AccentColorConverter" />
|
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer">
|
<ControlTheme x:Key="{x:Type ColorPreviewer}" TargetType="ColorPreviewer">
|
||||||
<Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" />
|
<Setter Property="Height" Value="{DynamicResource ColorPreviewerHeight}" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource ColorPreviewerCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ColorPreviewerCornerRadius}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorPreviewer}">
|
<ControlTemplate TargetType="ColorPreviewer">
|
||||||
<Panel>
|
<Panel>
|
||||||
<!-- Preview color with accents to the left and right -->
|
<!-- Preview color with accents to the left and right -->
|
||||||
<Grid ColumnDefinitions="Auto,*,Auto" IsVisible="{TemplateBinding IsAccentColorsVisible}">
|
<Grid ColumnDefinitions="Auto,*,Auto" IsVisible="{TemplateBinding IsAccentColorsVisible}">
|
||||||
|
|||||||
@@ -1,9 +1,6 @@
|
|||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
|
||||||
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
|
|
||||||
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
|
|
||||||
|
|
||||||
<ControlTheme x:Key="ColorSliderThumbTheme" TargetType="Thumb">
|
<ControlTheme x:Key="ColorSliderThumbTheme" TargetType="Thumb">
|
||||||
<Setter Property="Background" Value="Transparent" />
|
<Setter Property="Background" Value="Transparent" />
|
||||||
@@ -12,7 +9,7 @@
|
|||||||
<Setter Property="BorderThickness" Value="{DynamicResource ColorSliderThumbBorderBrush}" />
|
<Setter Property="BorderThickness" Value="{DynamicResource ColorSliderThumbBorderBrush}" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderThumbCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderThumbCornerRadius}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate>
|
<ControlTemplate TargetType="Thumb">
|
||||||
<Border
|
<Border
|
||||||
Margin="1"
|
Margin="1"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
@@ -30,33 +27,30 @@
|
|||||||
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
|
||||||
<Setter Property="Height" Value="{DynamicResource ColorSliderWidth}" />
|
<Setter Property="Height" Value="{DynamicResource ColorSliderWidth}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorSlider}">
|
<ControlTemplate TargetType="ColorSlider">
|
||||||
<Border
|
<Border
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Grid Margin="{TemplateBinding Padding}">
|
<Grid Margin="{TemplateBinding Padding}">
|
||||||
<Rectangle
|
<Border
|
||||||
Width="{Binding #PART_Track.Bounds.Width}"
|
|
||||||
Height="{Binding #PART_Track.Bounds.Height}"
|
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Center"
|
||||||
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
|
||||||
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
|
|
||||||
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
|
|
||||||
<Rectangle
|
|
||||||
Width="{Binding #PART_Track.Bounds.Width}"
|
|
||||||
Height="{Binding #PART_Track.Bounds.Height}"
|
Height="{Binding #PART_Track.Bounds.Height}"
|
||||||
|
Background="{StaticResource ColorControlCheckeredBackgroundBrush}"
|
||||||
|
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
|
||||||
|
<Border
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Center"
|
||||||
Fill="{TemplateBinding Background}"
|
Height="{Binding #PART_Track.Bounds.Height}"
|
||||||
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
|
Background="{TemplateBinding Background}"
|
||||||
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
|
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
|
||||||
|
|
||||||
<Track
|
<Track
|
||||||
Name="PART_Track"
|
Name="PART_Track"
|
||||||
Height="12"
|
Height="12"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Center"
|
||||||
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
||||||
Maximum="{TemplateBinding Maximum}"
|
Maximum="{TemplateBinding Maximum}"
|
||||||
Minimum="{TemplateBinding Minimum}"
|
Minimum="{TemplateBinding Minimum}"
|
||||||
@@ -101,7 +95,7 @@
|
|||||||
Width="{TemplateBinding Height}"
|
Width="{TemplateBinding Height}"
|
||||||
Height="{TemplateBinding Height}"
|
Height="{TemplateBinding Height}"
|
||||||
DataContext="{TemplateBinding Value}"
|
DataContext="{TemplateBinding Value}"
|
||||||
Theme="{StaticResource ColorSliderThumbTheme}" />
|
Theme="{DynamicResource ColorSliderThumbTheme}" />
|
||||||
</Track>
|
</Track>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -114,32 +108,28 @@
|
|||||||
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ColorSliderCornerRadius}" />
|
||||||
<Setter Property="Width" Value="{DynamicResource ColorSliderWidth}" />
|
<Setter Property="Width" Value="{DynamicResource ColorSliderWidth}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorSlider}">
|
<ControlTemplate TargetType="ColorSlider">
|
||||||
<Border
|
<Border
|
||||||
BorderBrush="{TemplateBinding BorderBrush}"
|
BorderBrush="{TemplateBinding BorderBrush}"
|
||||||
BorderThickness="{TemplateBinding BorderThickness}"
|
BorderThickness="{TemplateBinding BorderThickness}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<Grid Margin="{TemplateBinding Padding}">
|
<Grid Margin="{TemplateBinding Padding}">
|
||||||
<Rectangle
|
<Border
|
||||||
Width="{Binding #PART_Track.Bounds.Width}"
|
HorizontalAlignment="Center"
|
||||||
Height="{Binding #PART_Track.Bounds.Height}"
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Fill="{DynamicResource ColorControlCheckeredBackgroundBrush}"
|
|
||||||
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
|
|
||||||
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
|
|
||||||
<Rectangle
|
|
||||||
Width="{Binding #PART_Track.Bounds.Width}"
|
Width="{Binding #PART_Track.Bounds.Width}"
|
||||||
Height="{Binding #PART_Track.Bounds.Height}"
|
Background="{StaticResource ColorControlCheckeredBackgroundBrush}"
|
||||||
HorizontalAlignment="Stretch"
|
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
|
||||||
|
<Border
|
||||||
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Fill="{TemplateBinding Background}"
|
Width="{Binding #PART_Track.Bounds.Width}"
|
||||||
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
|
Background="{TemplateBinding Background}"
|
||||||
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
|
CornerRadius="{DynamicResource ColorSliderCornerRadius}" />
|
||||||
<Track
|
<Track
|
||||||
Name="PART_Track"
|
Name="PART_Track"
|
||||||
Width="12"
|
Width="12"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
IsDirectionReversed="{TemplateBinding IsDirectionReversed}"
|
||||||
Maximum="{TemplateBinding Maximum}"
|
Maximum="{TemplateBinding Maximum}"
|
||||||
@@ -185,7 +175,7 @@
|
|||||||
Width="{TemplateBinding Width}"
|
Width="{TemplateBinding Width}"
|
||||||
Height="{TemplateBinding Width}"
|
Height="{TemplateBinding Width}"
|
||||||
DataContext="{TemplateBinding Value}"
|
DataContext="{TemplateBinding Value}"
|
||||||
Theme="{StaticResource ColorSliderThumbTheme}" />
|
Theme="{DynamicResource ColorSliderThumbTheme}" />
|
||||||
</Track>
|
</Track>
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
|
|||||||
@@ -1,15 +1,11 @@
|
|||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
xmlns:converters="using:Avalonia.Controls.Converters">
|
|
||||||
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
|
|
||||||
<converters:CornerRadiusToDoubleConverter x:Key="TopLeftCornerRadiusConverter" Corner="TopLeft" />
|
|
||||||
<converters:CornerRadiusToDoubleConverter x:Key="BottomRightCornerRadiusConverter" Corner="BottomRight" />
|
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type ColorSpectrum}" TargetType="ColorSpectrum">
|
<ControlTheme x:Key="{x:Type ColorSpectrum}" TargetType="ColorSpectrum">
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource ColorSpectrumCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ColorSpectrumCornerRadius}" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorSpectrum}">
|
<ControlTemplate TargetType="ColorSpectrum">
|
||||||
<Panel
|
<Panel
|
||||||
Name="PART_LayoutRoot"
|
Name="PART_LayoutRoot"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
@@ -25,27 +21,27 @@
|
|||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="{TemplateBinding Shape,
|
IsVisible="{TemplateBinding Shape,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={x:Static ObjectConverters.Equal},
|
||||||
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
|
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
|
||||||
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
|
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
|
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
<Rectangle
|
<Rectangle
|
||||||
Name="PART_SpectrumOverlayRectangle"
|
Name="PART_SpectrumOverlayRectangle"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="{TemplateBinding Shape,
|
IsVisible="{TemplateBinding Shape,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={x:Static ObjectConverters.Equal},
|
||||||
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
|
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
|
||||||
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
|
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
|
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
<Ellipse
|
<Ellipse
|
||||||
Name="PART_SpectrumEllipse"
|
Name="PART_SpectrumEllipse"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="{TemplateBinding Shape,
|
IsVisible="{TemplateBinding Shape,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={x:Static ObjectConverters.Equal},
|
||||||
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
|
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
|
||||||
<Ellipse
|
<Ellipse
|
||||||
Name="PART_SpectrumOverlayEllipse"
|
Name="PART_SpectrumOverlayEllipse"
|
||||||
@@ -53,7 +49,7 @@
|
|||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="{TemplateBinding Shape,
|
IsVisible="{TemplateBinding Shape,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={x:Static ObjectConverters.Equal},
|
||||||
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
|
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
|
||||||
<Canvas
|
<Canvas
|
||||||
Name="PART_InputTarget"
|
Name="PART_InputTarget"
|
||||||
@@ -89,17 +85,17 @@
|
|||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="{TemplateBinding Shape,
|
IsVisible="{TemplateBinding Shape,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={x:Static ObjectConverters.Equal},
|
||||||
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
|
ConverterParameter={x:Static ColorSpectrumShape.Box}}"
|
||||||
RadiusX="{TemplateBinding CornerRadius,Converter={StaticResource TopLeftCornerRadiusConverter}}"
|
RadiusX="{Binding CornerRadius.TopLeft,RelativeSource={RelativeSource TemplatedParent}}"
|
||||||
RadiusY="{TemplateBinding CornerRadius,Converter={StaticResource BottomRightCornerRadiusConverter}}" />
|
RadiusY="{Binding CornerRadius.BottomRight,RelativeSource={RelativeSource TemplatedParent}}" />
|
||||||
<Ellipse
|
<Ellipse
|
||||||
Name="BorderEllipse"
|
Name="BorderEllipse"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
IsVisible="{TemplateBinding Shape,
|
IsVisible="{TemplateBinding Shape,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={x:Static ObjectConverters.Equal},
|
||||||
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
|
ConverterParameter={x:Static ColorSpectrumShape.Ring}}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|||||||
@@ -1,28 +1,23 @@
|
|||||||
<ResourceDictionary
|
<ResourceDictionary
|
||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
xmlns:converters="using:Avalonia.Controls.Converters"
|
xmlns:semi="https://irihi.tech/semi">
|
||||||
xmlns:globalization="using:System.Globalization"
|
|
||||||
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
|
|
||||||
xmlns:cvts="clr-namespace:Semi.Avalonia.ColorPicker.Converters">
|
|
||||||
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
|
|
||||||
<converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" />
|
|
||||||
<converters:ColorToHexConverter x:Key="ColorToHexConverter" />
|
|
||||||
<converters:DoNothingForNullConverter x:Key="DoNothingForNullConverter" />
|
|
||||||
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
|
|
||||||
<converters:ToBrushConverter x:Key="ToBrushConverter" />
|
|
||||||
<cvts:HsvColorToTextConverter x:Key="HsvColorToTextConverter" />
|
|
||||||
<cvts:ColorToTextConverter x:Key="ColorToTextConverter" />
|
|
||||||
<cvts:ToColorModel x:Key="ToColorModel" />
|
|
||||||
<globalization:NumberFormatInfo x:Key="ColorViewComponentNumberFormat" NumberDecimalDigits="0" />
|
|
||||||
|
|
||||||
<Design.PreviewWith>
|
<Design.PreviewWith>
|
||||||
<ColorView
|
<StackPanel>
|
||||||
Theme="{StaticResource SimpleColorView}"
|
<ColorView
|
||||||
IsAlphaVisible="True"
|
SelectedIndex="2"
|
||||||
IsAlphaEnabled="True"
|
IsAlphaVisible="True"
|
||||||
ColorModel="Hsva"
|
IsAlphaEnabled="True"
|
||||||
HsvColor="hsv(120,7%,90%)" />
|
ColorModel="Hsva"
|
||||||
|
HsvColor="hsv(120,7%,90%)" />
|
||||||
|
<ColorView
|
||||||
|
Theme="{DynamicResource SimpleColorView}"
|
||||||
|
IsAlphaVisible="True"
|
||||||
|
IsAlphaEnabled="True"
|
||||||
|
ColorModel="Hsva"
|
||||||
|
HsvColor="hsv(120,7%,90%)" />
|
||||||
|
</StackPanel>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
|
|
||||||
<VisualBrush
|
<VisualBrush
|
||||||
@@ -32,16 +27,12 @@
|
|||||||
TileMode="Tile">
|
TileMode="Tile">
|
||||||
<VisualBrush.Visual>
|
<VisualBrush.Visual>
|
||||||
<Image Width="8" Height="8">
|
<Image Width="8" Height="8">
|
||||||
<Image.Source>
|
<DrawingImage>
|
||||||
<DrawingImage>
|
<DrawingGroup>
|
||||||
<DrawingImage.Drawing>
|
<GeometryDrawing Brush="Transparent" Geometry="M0 0H2V2H0Z" />
|
||||||
<DrawingGroup>
|
<GeometryDrawing Brush="#19808080" Geometry="M0 1H2V2H1V0H0Z" />
|
||||||
<GeometryDrawing Brush="Transparent" Geometry="M0,0 L2,0 2,2, 0,2Z" />
|
</DrawingGroup>
|
||||||
<GeometryDrawing Brush="#19808080" Geometry="M0,1 L2,1 2,2, 1,2 1,0 0,0Z" />
|
</DrawingImage>
|
||||||
</DrawingGroup>
|
|
||||||
</DrawingImage.Drawing>
|
|
||||||
</DrawingImage>
|
|
||||||
</Image.Source>
|
|
||||||
</Image>
|
</Image>
|
||||||
</VisualBrush.Visual>
|
</VisualBrush.Visual>
|
||||||
</VisualBrush>
|
</VisualBrush>
|
||||||
@@ -61,11 +52,11 @@
|
|||||||
CornerRadius="{TemplateBinding CornerRadius}">
|
CornerRadius="{TemplateBinding CornerRadius}">
|
||||||
<ScrollViewer
|
<ScrollViewer
|
||||||
Name="PART_ScrollViewer"
|
Name="PART_ScrollViewer"
|
||||||
AllowAutoHide="{TemplateBinding (ScrollViewer.AllowAutoHide)}"
|
AllowAutoHide="{TemplateBinding ScrollViewer.AllowAutoHide}"
|
||||||
HorizontalScrollBarVisibility="{TemplateBinding (ScrollViewer.HorizontalScrollBarVisibility)}"
|
HorizontalScrollBarVisibility="{TemplateBinding ScrollViewer.HorizontalScrollBarVisibility}"
|
||||||
IsScrollChainingEnabled="{TemplateBinding (ScrollViewer.IsScrollChainingEnabled)}"
|
IsScrollChainingEnabled="{TemplateBinding ScrollViewer.IsScrollChainingEnabled}"
|
||||||
IsDeferredScrollingEnabled="{TemplateBinding (ScrollViewer.IsDeferredScrollingEnabled)}"
|
IsDeferredScrollingEnabled="{TemplateBinding ScrollViewer.IsDeferredScrollingEnabled}"
|
||||||
VerticalScrollBarVisibility="{TemplateBinding (ScrollViewer.VerticalScrollBarVisibility)}">
|
VerticalScrollBarVisibility="{TemplateBinding ScrollViewer.VerticalScrollBarVisibility}">
|
||||||
<ItemsPresenter
|
<ItemsPresenter
|
||||||
Name="PART_ItemsPresenter"
|
Name="PART_ItemsPresenter"
|
||||||
Margin="{TemplateBinding Padding}"
|
Margin="{TemplateBinding Padding}"
|
||||||
@@ -82,8 +73,8 @@
|
|||||||
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
<Setter Property="HorizontalContentAlignment" Value="Stretch" />
|
||||||
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
<Setter Property="VerticalContentAlignment" Value="Stretch" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ListBoxItem}">
|
<ControlTemplate TargetType="ListBoxItem">
|
||||||
<Grid UseLayoutRounding="False">
|
<Panel UseLayoutRounding="False">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_ContentPresenter"
|
Name="PART_ContentPresenter"
|
||||||
Padding="{TemplateBinding Padding}"
|
Padding="{TemplateBinding Padding}"
|
||||||
@@ -101,7 +92,7 @@
|
|||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
IsHitTestVisible="False"
|
IsHitTestVisible="False"
|
||||||
StrokeThickness="1" />
|
StrokeThickness="1" />
|
||||||
</Grid>
|
</Panel>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
|
||||||
@@ -141,12 +132,14 @@
|
|||||||
Content="{TemplateBinding Content}"
|
Content="{TemplateBinding Content}"
|
||||||
ContentTemplate="{TemplateBinding ContentTemplate}"
|
ContentTemplate="{TemplateBinding ContentTemplate}"
|
||||||
CornerRadius="{TemplateBinding CornerRadius}"
|
CornerRadius="{TemplateBinding CornerRadius}"
|
||||||
RecognizesAccessKey="True"
|
|
||||||
TextElement.FontSize="{TemplateBinding FontSize}"
|
TextElement.FontSize="{TemplateBinding FontSize}"
|
||||||
TextElement.FontWeight="{TemplateBinding FontWeight}"
|
TextElement.FontWeight="{TemplateBinding FontWeight}"
|
||||||
UseLayoutRounding="False" />
|
UseLayoutRounding="False" />
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
|
<Style Selector="^ /template/ ContentPresenter#PART_ContentPresenter">
|
||||||
|
<Setter Property="RecognizesAccessKey" Value="True" />
|
||||||
|
</Style>
|
||||||
<Style Selector="^:checked">
|
<Style Selector="^:checked">
|
||||||
<Setter Property="Background" Value="{DynamicResource ColorViewRadioButtonCheckedBackground}" />
|
<Setter Property="Background" Value="{DynamicResource ColorViewRadioButtonCheckedBackground}" />
|
||||||
<Setter Property="Foreground" Value="{DynamicResource ColorViewRadioButtonCheckedForeground}" />
|
<Setter Property="Foreground" Value="{DynamicResource ColorViewRadioButtonCheckedForeground}" />
|
||||||
@@ -168,14 +161,14 @@
|
|||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type ColorView}" TargetType="ColorView">
|
<ControlTheme x:Key="{x:Type ColorView}" TargetType="ColorView">
|
||||||
|
<!-- Alpha position should match CSS (and default slider order) instead of XAML/WinUI -->
|
||||||
|
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||||
<Setter Property="Width" Value="300" />
|
<Setter Property="Width" Value="300" />
|
||||||
<Setter Property="Height" Value="300" />
|
<Setter Property="Height" Value="300" />
|
||||||
<Setter Property="Palette">
|
<Setter Property="Palette" Value="{DynamicResource SemiColorPalette}" />
|
||||||
<FluentColorPalette />
|
|
||||||
</Setter>
|
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorView}">
|
<ControlTemplate TargetType="ColorView">
|
||||||
<Grid RowDefinitions="*,Auto">
|
<Grid RowDefinitions="*,Auto">
|
||||||
<!-- Backgrounds -->
|
<!-- Backgrounds -->
|
||||||
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
|
<!-- TODO: Background="{DynamicResource ColorViewTabBackgroundBrush}" -->
|
||||||
@@ -197,7 +190,7 @@
|
|||||||
Padding="0"
|
Padding="0"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
HorizontalContentAlignment="Stretch"
|
HorizontalContentAlignment="Stretch"
|
||||||
SelectedIndex="{Binding SelectedIndex, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}">
|
SelectedIndex="{TemplateBinding SelectedIndex, Mode=TwoWay}">
|
||||||
<TabControl.Styles>
|
<TabControl.Styles>
|
||||||
<Style Selector="TabItem">
|
<Style Selector="TabItem">
|
||||||
<Setter Property="MinHeight" Value="32" />
|
<Setter Property="MinHeight" Value="32" />
|
||||||
@@ -232,11 +225,11 @@
|
|||||||
HorizontalAlignment="Center"
|
HorizontalAlignment="Center"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
AutomationProperties.Name="Third Component"
|
AutomationProperties.Name="Third Component"
|
||||||
ColorComponent="{Binding ThirdComponent, ElementName=ColorSpectrum}"
|
ColorComponent="{Binding #ColorSpectrum.ThirdComponent}"
|
||||||
ColorModel="Hsva"
|
ColorModel="Hsva"
|
||||||
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
|
HsvColor="{Binding #ColorSpectrum.HsvColor}"
|
||||||
IsAlphaVisible="True"
|
IsAlphaVisible="False"
|
||||||
IsPerceptive="False"
|
IsPerceptive="True"
|
||||||
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
IsVisible="{TemplateBinding IsColorSpectrumSliderVisible}"
|
||||||
Orientation="Vertical" />
|
Orientation="Vertical" />
|
||||||
<ColorSpectrum
|
<ColorSpectrum
|
||||||
@@ -245,7 +238,7 @@
|
|||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
Components="{TemplateBinding ColorSpectrumComponents}"
|
Components="{TemplateBinding ColorSpectrumComponents}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
MaxHue="{TemplateBinding MaxHue}"
|
MaxHue="{TemplateBinding MaxHue}"
|
||||||
MaxSaturation="{TemplateBinding MaxSaturation}"
|
MaxSaturation="{TemplateBinding MaxSaturation}"
|
||||||
MaxValue="{TemplateBinding MaxValue}"
|
MaxValue="{TemplateBinding MaxValue}"
|
||||||
@@ -262,14 +255,10 @@
|
|||||||
AutomationProperties.Name="Alpha Component"
|
AutomationProperties.Name="Alpha Component"
|
||||||
ColorComponent="Alpha"
|
ColorComponent="Alpha"
|
||||||
ColorModel="Hsva"
|
ColorModel="Hsva"
|
||||||
HsvColor="{Binding HsvColor, ElementName=ColorSpectrum}"
|
HsvColor="{Binding #ColorSpectrum.HsvColor}"
|
||||||
|
IsVisible="{TemplateBinding IsAlphaVisible}"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
Orientation="Vertical">
|
Orientation="Vertical">
|
||||||
<ColorSlider.IsVisible>
|
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
|
||||||
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
|
||||||
</MultiBinding>
|
|
||||||
</ColorSlider.IsVisible>
|
|
||||||
</ColorSlider>
|
</ColorSlider>
|
||||||
</Grid>
|
</Grid>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
@@ -286,11 +275,11 @@
|
|||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
|
ItemContainerTheme="{StaticResource ColorViewPaletteListBoxItemTheme}"
|
||||||
ItemsSource="{TemplateBinding PaletteColors}"
|
ItemsSource="{TemplateBinding PaletteColors}"
|
||||||
SelectedItem="{Binding Color, RelativeSource={RelativeSource TemplatedParent}, Converter={StaticResource DoNothingForNullConverter}, Mode=TwoWay}"
|
SelectedItem="{TemplateBinding Color, Mode=TwoWay, Converter={StaticResource DoNothingForNullConverter}}"
|
||||||
Theme="{StaticResource ColorViewPaletteListBoxTheme}"
|
Theme="{StaticResource ColorViewPaletteListBoxTheme}"
|
||||||
UseLayoutRounding="False">
|
UseLayoutRounding="False">
|
||||||
<ListBox.ItemTemplate>
|
<ListBox.ItemTemplate>
|
||||||
<DataTemplate DataType="{x:Type Color}">
|
<DataTemplate DataType="Color">
|
||||||
<Border
|
<Border
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
@@ -322,6 +311,10 @@
|
|||||||
ColumnDefinitions="Auto,*"
|
ColumnDefinitions="Auto,*"
|
||||||
RowDefinitions="Auto,24,*,*,*,*,12"
|
RowDefinitions="Auto,24,*,*,*,*,12"
|
||||||
UseLayoutRounding="False">
|
UseLayoutRounding="False">
|
||||||
|
<Grid.Resources>
|
||||||
|
<Thickness x:Key="TextBoxContentPadding">8 0</Thickness>
|
||||||
|
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 8 0</Thickness>
|
||||||
|
</Grid.Resources>
|
||||||
<Grid.Styles>
|
<Grid.Styles>
|
||||||
<Style Selector="NumericUpDown">
|
<Style Selector="NumericUpDown">
|
||||||
<Setter Property="InnerLeftContent">
|
<Setter Property="InnerLeftContent">
|
||||||
@@ -351,9 +344,9 @@
|
|||||||
Content="RGB"
|
Content="RGB"
|
||||||
CornerRadius="3,0,0,3"
|
CornerRadius="3,0,0,3"
|
||||||
IsChecked="{TemplateBinding ColorModel,
|
IsChecked="{TemplateBinding ColorModel,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={StaticResource EnumToBoolConverter},
|
||||||
ConverterParameter={x:Static ColorModel.Rgba},
|
ConverterParameter={x:Static ColorModel.Rgba},
|
||||||
Mode=TwoWay}"
|
Mode=TwoWay}"
|
||||||
Theme="{DynamicResource ColorViewRadioButton}" />
|
Theme="{DynamicResource ColorViewRadioButton}" />
|
||||||
<RadioButton
|
<RadioButton
|
||||||
Name="HsvRadioButton"
|
Name="HsvRadioButton"
|
||||||
@@ -363,9 +356,9 @@
|
|||||||
Content="HSV"
|
Content="HSV"
|
||||||
CornerRadius="0,3,3,0"
|
CornerRadius="0,3,3,0"
|
||||||
IsChecked="{TemplateBinding ColorModel,
|
IsChecked="{TemplateBinding ColorModel,
|
||||||
Converter={StaticResource EnumToBoolConverter},
|
Converter={StaticResource EnumToBoolConverter},
|
||||||
ConverterParameter={x:Static ColorModel.Hsva},
|
ConverterParameter={x:Static ColorModel.Hsva},
|
||||||
Mode=TwoWay}"
|
Mode=TwoWay}"
|
||||||
Theme="{DynamicResource ColorViewRadioButton}" />
|
Theme="{DynamicResource ColorViewRadioButton}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
</Border>
|
</Border>
|
||||||
@@ -390,11 +383,11 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
||||||
Maximum="{Binding Maximum, ElementName=Component1Slider}"
|
Maximum="{Binding #Component1Slider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=Component1Slider}"
|
Minimum="{Binding #Component1Slider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component1Slider}" />
|
Value="{Binding #Component1Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
|
||||||
<ColorSlider
|
<ColorSlider
|
||||||
Name="Component1Slider"
|
Name="Component1Slider"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
@@ -403,7 +396,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Component1"
|
ColorComponent="Component1"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
||||||
@@ -420,11 +413,11 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
||||||
Maximum="{Binding Maximum, ElementName=Component2Slider}"
|
Maximum="{Binding #Component2Slider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=Component2Slider}"
|
Minimum="{Binding #Component2Slider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component2Slider}" />
|
Value="{Binding #Component2Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
|
||||||
<ColorSlider
|
<ColorSlider
|
||||||
Name="Component2Slider"
|
Name="Component2Slider"
|
||||||
Grid.Row="3"
|
Grid.Row="3"
|
||||||
@@ -433,7 +426,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Component2"
|
ColorComponent="Component2"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
||||||
@@ -450,11 +443,11 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
IsVisible="{TemplateBinding IsComponentTextInputVisible}"
|
||||||
Maximum="{Binding Maximum, ElementName=Component3Slider}"
|
Maximum="{Binding #Component3Slider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=Component3Slider}"
|
Minimum="{Binding #Component3Slider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=Component3Slider}" />
|
Value="{Binding #Component3Slider.Value,Converter={StaticResource DoNothingForNullConverter}}" />
|
||||||
<ColorSlider
|
<ColorSlider
|
||||||
Name="Component3Slider"
|
Name="Component3Slider"
|
||||||
Grid.Row="4"
|
Grid.Row="4"
|
||||||
@@ -463,7 +456,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Component3"
|
ColorComponent="Component3"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
IsVisible="{TemplateBinding IsComponentSliderVisible}"
|
||||||
@@ -480,15 +473,15 @@
|
|||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
Maximum="{Binding Maximum, ElementName=AlphaComponentSlider}"
|
Maximum="{Binding #AlphaComponentSlider.Maximum}"
|
||||||
Minimum="{Binding Minimum, ElementName=AlphaComponentSlider}"
|
Minimum="{Binding #AlphaComponentSlider.Minimum}"
|
||||||
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
NumberFormat="{StaticResource ColorViewComponentNumberFormat}"
|
||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
Value="{Binding Value, ElementName=AlphaComponentSlider}">
|
Value="{Binding #AlphaComponentSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
|
||||||
<NumericUpDown.IsVisible>
|
<NumericUpDown.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsAlphaVisible" />
|
||||||
<Binding Path="IsComponentTextInputVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsComponentTextInputVisible" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</NumericUpDown.IsVisible>
|
</NumericUpDown.IsVisible>
|
||||||
</NumericUpDown>
|
</NumericUpDown>
|
||||||
@@ -500,7 +493,7 @@
|
|||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
ColorComponent="Alpha"
|
ColorComponent="Alpha"
|
||||||
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
ColorModel="{TemplateBinding ColorModel,Mode=OneWay}"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
IsRoundingEnabled="True"
|
IsRoundingEnabled="True"
|
||||||
IsSnapToTickEnabled="True"
|
IsSnapToTickEnabled="True"
|
||||||
@@ -508,8 +501,8 @@
|
|||||||
TickFrequency="1">
|
TickFrequency="1">
|
||||||
<ColorSlider.IsVisible>
|
<ColorSlider.IsVisible>
|
||||||
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
<MultiBinding Converter="{x:Static BoolConverters.And}">
|
||||||
<Binding Path="IsAlphaVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsAlphaVisible" />
|
||||||
<Binding Path="IsComponentSliderVisible" RelativeSource="{RelativeSource TemplatedParent}" />
|
<TemplateBinding Property="IsComponentSliderVisible" />
|
||||||
</MultiBinding>
|
</MultiBinding>
|
||||||
</ColorSlider.IsVisible>
|
</ColorSlider.IsVisible>
|
||||||
</ColorSlider>
|
</ColorSlider>
|
||||||
@@ -517,11 +510,11 @@
|
|||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
<!-- Previewer -->
|
<!-- Previewer -->
|
||||||
<!-- Note that top/bottom margins have -5 to remove for drop shadow padding -->
|
<!-- Note that the drop shadow is allowed to extend past the control bounds -->
|
||||||
<ColorPreviewer
|
<ColorPreviewer
|
||||||
Grid.Row="1"
|
Grid.Row="1"
|
||||||
Margin="12,-5,12,7"
|
Margin="12,0,12,12"
|
||||||
HsvColor="{Binding HsvColor, RelativeSource={RelativeSource TemplatedParent}, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
|
IsAccentColorsVisible="{TemplateBinding IsAccentColorsVisible}"
|
||||||
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
|
IsVisible="{TemplateBinding IsColorPreviewVisible}" />
|
||||||
</Grid>
|
</Grid>
|
||||||
@@ -558,11 +551,12 @@
|
|||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="SimpleColorView" TargetType="ColorView">
|
<ControlTheme x:Key="SimpleColorView" TargetType="ColorView">
|
||||||
|
<Setter Property="HexInputAlphaPosition" Value="Trailing" />
|
||||||
<Setter Property="Width" Value="280" />
|
<Setter Property="Width" Value="280" />
|
||||||
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
<Setter Property="CornerRadius" Value="{DynamicResource ControlCornerRadius}" />
|
||||||
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
|
<Setter Property="ColorSpectrumComponents" Value="SaturationValue" />
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="{x:Type ColorView}">
|
<ControlTemplate TargetType="ColorView">
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="*" MinHeight="280" />
|
<RowDefinition Height="*" MinHeight="280" />
|
||||||
@@ -579,6 +573,7 @@
|
|||||||
Name="ColorSpectrum"
|
Name="ColorSpectrum"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Stretch"
|
VerticalAlignment="Stretch"
|
||||||
|
CornerRadius="8 8 0 0"
|
||||||
Components="{TemplateBinding ColorSpectrumComponents}"
|
Components="{TemplateBinding ColorSpectrumComponents}"
|
||||||
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
HsvColor="{TemplateBinding HsvColor, Mode=TwoWay}"
|
||||||
MaxHue="{TemplateBinding MaxHue}"
|
MaxHue="{TemplateBinding MaxHue}"
|
||||||
@@ -602,7 +597,7 @@
|
|||||||
Orientation="Horizontal" />
|
Orientation="Horizontal" />
|
||||||
|
|
||||||
<ColorSlider
|
<ColorSlider
|
||||||
x:Name="ColorSpectrumAlphaSlider"
|
Name="ColorSpectrumAlphaSlider"
|
||||||
Grid.Row="2"
|
Grid.Row="2"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
@@ -629,35 +624,43 @@
|
|||||||
CornerRadius="4" />
|
CornerRadius="4" />
|
||||||
<Panel
|
<Panel
|
||||||
Name="PART_TextBoxPanel"
|
Name="PART_TextBoxPanel"
|
||||||
Width="106"
|
Width="116"
|
||||||
Margin="4 0 0 0"
|
Margin="4 0 0 0"
|
||||||
HorizontalAlignment="Stretch"
|
HorizontalAlignment="Stretch"
|
||||||
VerticalAlignment="Center">
|
VerticalAlignment="Center">
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_HexTextBox"
|
Name="PART_HexTextBox"
|
||||||
|
AutomationProperties.Name="Hexadecimal Color"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
|
CornerRadius="3 0 0 3"
|
||||||
InnerLeftContent="#"
|
InnerLeftContent="#"
|
||||||
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hex}"
|
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter=Hex}"
|
||||||
Text="{TemplateBinding Color, Converter={StaticResource ColorToHexConverter}, Mode=TwoWay}"
|
MaxLength="8">
|
||||||
MaxLength="8" />
|
<TextBox.Resources>
|
||||||
|
<Thickness x:Key="TextBoxInnerLeftContentPadding">0 0 4 0</Thickness>
|
||||||
|
</TextBox.Resources>
|
||||||
|
</TextBox>
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_RgbaTextBox"
|
Name="PART_RgbaTextBox"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Rgba}"
|
CornerRadius="3 0 0 3"
|
||||||
Text="{TemplateBinding Color, Converter={StaticResource ColorToTextConverter}, Mode=TwoWay}" />
|
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Rgba}}"
|
||||||
|
Text="{TemplateBinding Color, Converter={semi:ColorToTextConverter}, Mode=TwoWay}" />
|
||||||
<TextBox
|
<TextBox
|
||||||
Name="PART_HsvaTextBox"
|
Name="PART_HsvaTextBox"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={StaticResource ToColorModel}, ConverterParameter=Hsva}"
|
CornerRadius="3 0 0 3"
|
||||||
Text="{TemplateBinding HsvColor, Converter={StaticResource HsvColorToTextConverter}, Mode=TwoWay}" />
|
IsVisible="{Binding #ColorModelComboBox.SelectedValue, Converter={x:Static ObjectConverters.Equal}, ConverterParameter={x:Static ColorModel.Hsva}}"
|
||||||
|
Text="{TemplateBinding HsvColor, Converter={semi:HsvColorToTextConverter}, Mode=TwoWay}" />
|
||||||
</Panel>
|
</Panel>
|
||||||
|
|
||||||
<NumericUpDown
|
<NumericUpDown
|
||||||
Name="AlphaComponentNumericUpDown"
|
Name="AlphaComponentNumericUpDown"
|
||||||
Width="70"
|
Width="60"
|
||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
AllowSpin="True"
|
AllowSpin="True"
|
||||||
|
CornerRadius="0"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
IsEnabled="{TemplateBinding IsAlphaEnabled}"
|
||||||
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
|
Maximum="{Binding #ColorSpectrumAlphaSlider.Maximum}"
|
||||||
@@ -666,14 +669,21 @@
|
|||||||
ShowButtonSpinner="False"
|
ShowButtonSpinner="False"
|
||||||
InnerRightContent="%"
|
InnerRightContent="%"
|
||||||
IsVisible="{TemplateBinding IsAlphaVisible}"
|
IsVisible="{TemplateBinding IsAlphaVisible}"
|
||||||
Value="{Binding #ColorSpectrumAlphaSlider.Value}" />
|
Value="{Binding #ColorSpectrumAlphaSlider.Value,Converter={StaticResource DoNothingForNullConverter}}">
|
||||||
|
<NumericUpDown.Resources>
|
||||||
|
<Thickness x:Key="TextBoxContentPadding">12 0 4 0</Thickness>
|
||||||
|
<Thickness x:Key="TextBoxInnerRightContentPadding">4 0 0 0</Thickness>
|
||||||
|
</NumericUpDown.Resources>
|
||||||
|
</NumericUpDown>
|
||||||
<ComboBox
|
<ComboBox
|
||||||
Name="ColorModelComboBox"
|
Name="ColorModelComboBox"
|
||||||
Width="80"
|
Width="80"
|
||||||
|
CornerRadius="0 3 3 0"
|
||||||
VerticalAlignment="Center"
|
VerticalAlignment="Center"
|
||||||
Classes="Small"
|
Classes="Small"
|
||||||
SelectedValue="Hex">
|
SelectedValue="Hex">
|
||||||
Hex<ColorModel>Rgba</ColorModel>
|
<x:String>Hex</x:String>
|
||||||
|
<ColorModel>Rgba</ColorModel>
|
||||||
<ColorModel>Hsva</ColorModel>
|
<ColorModel>Hsva</ColorModel>
|
||||||
</ComboBox>
|
</ComboBox>
|
||||||
</StackPanel>
|
</StackPanel>
|
||||||
|
|||||||
17
src/Semi.Avalonia.ColorPicker/Controls/Converters.axaml
Normal file
17
src/Semi.Avalonia.ColorPicker/Controls/Converters.axaml
Normal file
@@ -0,0 +1,17 @@
|
|||||||
|
<ResourceDictionary xmlns="https://github.com/avaloniaui"
|
||||||
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
|
xmlns:converters="using:Avalonia.Controls.Converters"
|
||||||
|
xmlns:pc="using:Avalonia.Controls.Primitives.Converters"
|
||||||
|
xmlns:globalization="using:System.Globalization">
|
||||||
|
<pc:ContrastBrushConverter x:Key="ContrastBrushConverter" />
|
||||||
|
<pc:AccentColorConverter x:Key="AccentColorConverter" />
|
||||||
|
|
||||||
|
<converters:ColorToDisplayNameConverter x:Key="ColorToDisplayNameConverter" />
|
||||||
|
<converters:DoNothingForNullConverter x:Key="DoNothingForNullConverter" />
|
||||||
|
<converters:ToBrushConverter x:Key="ToBrushConverter" />
|
||||||
|
<converters:ColorToHexConverter x:Key="ColorToHexConverter" AlphaPosition="Trailing" IsAlphaVisible="True" />
|
||||||
|
|
||||||
|
<converters:EnumToBoolConverter x:Key="EnumToBoolConverter" />
|
||||||
|
|
||||||
|
<globalization:NumberFormatInfo x:Key="ColorViewComponentNumberFormat" NumberDecimalDigits="0" />
|
||||||
|
</ResourceDictionary>
|
||||||
@@ -2,6 +2,7 @@
|
|||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
<ResourceInclude Source="Converters.axaml" />
|
||||||
<ResourceInclude Source="ColorPicker.axaml" />
|
<ResourceInclude Source="ColorPicker.axaml" />
|
||||||
<ResourceInclude Source="ColorPreviewer.axaml" />
|
<ResourceInclude Source="ColorPreviewer.axaml" />
|
||||||
<ResourceInclude Source="ColorSlider.axaml" />
|
<ResourceInclude Source="ColorSlider.axaml" />
|
||||||
|
|||||||
@@ -3,19 +3,19 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
using Irihi.Avalonia.Shared.Converters;
|
||||||
|
|
||||||
namespace Semi.Avalonia.ColorPicker.Converters;
|
namespace Semi.Avalonia.ColorPicker.Converters;
|
||||||
|
|
||||||
public class ColorToTextConverter : IValueConverter
|
public class ColorToTextConverter : MarkupValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return value is Color color ? $"{color.R},{color.G},{color.B},{color.A}" : AvaloniaProperty.UnsetValue;
|
return value is Color color ? $"{color.R},{color.G},{color.B},{color.A}" : AvaloniaProperty.UnsetValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value is not string str) return BindingOperations.DoNothing;
|
if (value is not string str) return BindingOperations.DoNothing;
|
||||||
var parts = str.Split(',');
|
var parts = str.Split(',');
|
||||||
|
|||||||
@@ -3,21 +3,21 @@ using System.Globalization;
|
|||||||
using System.Linq;
|
using System.Linq;
|
||||||
using Avalonia;
|
using Avalonia;
|
||||||
using Avalonia.Data;
|
using Avalonia.Data;
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
|
using Irihi.Avalonia.Shared.Converters;
|
||||||
|
|
||||||
namespace Semi.Avalonia.ColorPicker.Converters;
|
namespace Semi.Avalonia.ColorPicker.Converters;
|
||||||
|
|
||||||
public class HsvColorToTextConverter : IValueConverter
|
public class HsvColorToTextConverter : MarkupValueConverter
|
||||||
{
|
{
|
||||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
public override object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
return value is HsvColor hsvColor
|
return value is HsvColor hsvColor
|
||||||
? $"{Math.Round(hsvColor.H)},{Math.Round(hsvColor.S * 100)},{Math.Round(hsvColor.V * 100)},{Math.Round(hsvColor.A * 100)}"
|
? $"{Math.Round(hsvColor.H)},{Math.Round(hsvColor.S * 100)},{Math.Round(hsvColor.V * 100)},{Math.Round(hsvColor.A * 100)}"
|
||||||
: AvaloniaProperty.UnsetValue;
|
: AvaloniaProperty.UnsetValue;
|
||||||
}
|
}
|
||||||
|
|
||||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
public override object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
||||||
{
|
{
|
||||||
if (value is not string str) return BindingOperations.DoNothing;
|
if (value is not string str) return BindingOperations.DoNothing;
|
||||||
var parts = str.Split(',');
|
var parts = str.Split(',');
|
||||||
|
|||||||
@@ -1,21 +0,0 @@
|
|||||||
using System;
|
|
||||||
using System.Globalization;
|
|
||||||
using Avalonia.Controls;
|
|
||||||
using Avalonia.Data.Converters;
|
|
||||||
|
|
||||||
namespace Semi.Avalonia.ColorPicker.Converters;
|
|
||||||
|
|
||||||
public class ToColorModel : IValueConverter
|
|
||||||
{
|
|
||||||
public object Convert(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
return parameter is "Hex" && value is "Hex" ||
|
|
||||||
parameter is "Rgba" && value is ColorModel.Rgba ||
|
|
||||||
parameter is "Hsva" && value is ColorModel.Hsva;
|
|
||||||
}
|
|
||||||
|
|
||||||
public object ConvertBack(object? value, Type targetType, object? parameter, CultureInfo culture)
|
|
||||||
{
|
|
||||||
throw new NotImplementedException();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -3,6 +3,7 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.ThemeDictionaries>
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
<ResourceInclude x:Key="Default" Source="Light.axaml" />
|
<ResourceInclude x:Key="Default" Source="Light.axaml" />
|
||||||
|
<ResourceInclude x:Key="Light" Source="Light.axaml" />
|
||||||
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
|
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
|
||||||
</ResourceDictionary.ThemeDictionaries>
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
|||||||
@@ -1,3 +1,5 @@
|
|||||||
using Avalonia.Metadata;
|
using Avalonia.Metadata;
|
||||||
|
|
||||||
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker")]
|
[assembly: XmlnsPrefix("https://irihi.tech/semi", "semi")]
|
||||||
|
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker")]
|
||||||
|
[assembly: XmlnsDefinition("https://irihi.tech/semi", "Semi.Avalonia.ColorPicker.Converters")]
|
||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
|
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
|
||||||
<Version>12.0.0-rc1</Version>
|
<Version>12.0.0</Version>
|
||||||
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0-rc1</PackageReleaseNotes>
|
<PackageReleaseNotes>Update to Semi.Avalonia.ColorPicker 12.0.0</PackageReleaseNotes>
|
||||||
<Title>Semi.Avalonia.ColorPicker</Title>
|
<Title>Semi.Avalonia.ColorPicker</Title>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -1,13 +1,12 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Avalonia.Utilities;
|
|
||||||
using Irihi.Avalonia.Shared.Helpers;
|
using Irihi.Avalonia.Shared.Helpers;
|
||||||
|
|
||||||
namespace Semi.Avalonia.ColorPicker;
|
namespace Semi.Avalonia.ColorPicker;
|
||||||
|
|
||||||
public class SemiColorDarkPalette: IColorPalette
|
public class SemiColorDarkPalette : IColorPalette
|
||||||
{
|
{
|
||||||
private static readonly Color[,] Colors = new Color[,]
|
private static readonly Color[,] Colors = new[,]
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
//Red
|
//Red
|
||||||
@@ -217,7 +216,21 @@ public class SemiColorDarkPalette: IColorPalette
|
|||||||
Color.FromUInt32(0xFFE6E8EA),
|
Color.FromUInt32(0xFFE6E8EA),
|
||||||
Color.FromUInt32(0xFFF9F9F9),
|
Color.FromUInt32(0xFFF9F9F9),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
//AIPurple
|
||||||
|
Color.FromUInt32(0xFF3A1770),
|
||||||
|
Color.FromUInt32(0xFF532394),
|
||||||
|
Color.FromUInt32(0xFF6F31B8),
|
||||||
|
Color.FromUInt32(0xFF8D41DB),
|
||||||
|
Color.FromUInt32(0xFFA744FF),
|
||||||
|
Color.FromUInt32(0xFFC375FF),
|
||||||
|
Color.FromUInt32(0xFFD598FF),
|
||||||
|
Color.FromUInt32(0xFFE5BAFF),
|
||||||
|
Color.FromUInt32(0xFFF3DDFF),
|
||||||
|
Color.FromUInt32(0xFFFBF3FF),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
public Color GetColor(int colorIndex, int shadeIndex)
|
public Color GetColor(int colorIndex, int shadeIndex)
|
||||||
{
|
{
|
||||||
return Colors[
|
return Colors[
|
||||||
@@ -229,4 +242,4 @@ public class SemiColorDarkPalette: IColorPalette
|
|||||||
public int ColorCount => Colors.GetLength(0);
|
public int ColorCount => Colors.GetLength(0);
|
||||||
|
|
||||||
public int ShadeCount => Colors.GetLength(1);
|
public int ShadeCount => Colors.GetLength(1);
|
||||||
}
|
}
|
||||||
@@ -1,13 +1,12 @@
|
|||||||
using Avalonia.Controls;
|
using Avalonia.Controls;
|
||||||
using Avalonia.Media;
|
using Avalonia.Media;
|
||||||
using Avalonia.Utilities;
|
|
||||||
using Irihi.Avalonia.Shared.Helpers;
|
using Irihi.Avalonia.Shared.Helpers;
|
||||||
|
|
||||||
namespace Semi.Avalonia.ColorPicker;
|
namespace Semi.Avalonia.ColorPicker;
|
||||||
|
|
||||||
public class SemiColorLightPalette: IColorPalette
|
public class SemiColorLightPalette : IColorPalette
|
||||||
{
|
{
|
||||||
private static readonly Color[,] Colors = new Color[,]
|
private static readonly Color[,] Colors = new[,]
|
||||||
{
|
{
|
||||||
{
|
{
|
||||||
//Red
|
//Red
|
||||||
@@ -217,7 +216,21 @@ public class SemiColorLightPalette: IColorPalette
|
|||||||
Color.FromUInt32(0xFF2E3238),
|
Color.FromUInt32(0xFF2E3238),
|
||||||
Color.FromUInt32(0xFF1C1F23),
|
Color.FromUInt32(0xFF1C1F23),
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
//AIPurple
|
||||||
|
Color.FromUInt32(0xFFF8EDFF),
|
||||||
|
Color.FromUInt32(0xFFF2DAFF),
|
||||||
|
Color.FromUInt32(0xFFE3B5FF),
|
||||||
|
Color.FromUInt32(0xFFD191FF),
|
||||||
|
Color.FromUInt32(0xFFBD6CFF),
|
||||||
|
Color.FromUInt32(0xFFA647FF),
|
||||||
|
Color.FromUInt32(0xFF8636DB),
|
||||||
|
Color.FromUInt32(0xFF6928B8),
|
||||||
|
Color.FromUInt32(0xFF4E1C94),
|
||||||
|
Color.FromUInt32(0xFF361270),
|
||||||
|
},
|
||||||
};
|
};
|
||||||
|
|
||||||
public Color GetColor(int colorIndex, int shadeIndex)
|
public Color GetColor(int colorIndex, int shadeIndex)
|
||||||
{
|
{
|
||||||
return Colors[
|
return Colors[
|
||||||
|
|||||||
@@ -3,6 +3,7 @@
|
|||||||
<ResourceDictionary>
|
<ResourceDictionary>
|
||||||
<ResourceDictionary.ThemeDictionaries>
|
<ResourceDictionary.ThemeDictionaries>
|
||||||
<ResourceInclude x:Key="Default" Source="Light.axaml" />
|
<ResourceInclude x:Key="Default" Source="Light.axaml" />
|
||||||
|
<ResourceInclude x:Key="Light" Source="Light.axaml" />
|
||||||
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
|
<ResourceInclude x:Key="Dark" Source="Dark.axaml" />
|
||||||
</ResourceDictionary.ThemeDictionaries>
|
</ResourceDictionary.ThemeDictionaries>
|
||||||
<ResourceDictionary.MergedDictionaries>
|
<ResourceDictionary.MergedDictionaries>
|
||||||
|
|||||||
@@ -2,8 +2,8 @@
|
|||||||
|
|
||||||
<PropertyGroup>
|
<PropertyGroup>
|
||||||
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
|
<TargetFrameworks>net8.0;net10.0</TargetFrameworks>
|
||||||
<Version>12.0.0-rc1</Version>
|
<Version>12.0.0</Version>
|
||||||
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 12.0.0-rc1</PackageReleaseNotes>
|
<PackageReleaseNotes>Update to Semi.Avalonia.DataGrid 12.0.0</PackageReleaseNotes>
|
||||||
<Title>Semi.Avalonia.DataGrid</Title>
|
<Title>Semi.Avalonia.DataGrid</Title>
|
||||||
</PropertyGroup>
|
</PropertyGroup>
|
||||||
|
|
||||||
|
|||||||
@@ -31,7 +31,6 @@
|
|||||||
<DockPanel HorizontalSpacing="{DynamicResource TabItemIconHeaderSpacing}">
|
<DockPanel HorizontalSpacing="{DynamicResource TabItemIconHeaderSpacing}">
|
||||||
<ContentPresenter
|
<ContentPresenter
|
||||||
Name="PART_IconPresenter"
|
Name="PART_IconPresenter"
|
||||||
DockPanel.Dock="Left"
|
|
||||||
Content="{TemplateBinding Icon}"
|
Content="{TemplateBinding Icon}"
|
||||||
ContentTemplate="{TemplateBinding IconTemplate}"
|
ContentTemplate="{TemplateBinding IconTemplate}"
|
||||||
IsVisible="{Binding $self.Content, Converter={x:Static ObjectConverters.IsNotNull}}">
|
IsVisible="{Binding $self.Content, Converter={x:Static ObjectConverters.IsNotNull}}">
|
||||||
@@ -61,6 +60,10 @@
|
|||||||
<Setter Property="RecognizesAccessKey" Value="True" />
|
<Setter Property="RecognizesAccessKey" Value="True" />
|
||||||
</Style>
|
</Style>
|
||||||
|
|
||||||
|
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
|
||||||
|
<Setter Property="DockPanel.Dock" Value="Left" />
|
||||||
|
</Style>
|
||||||
|
|
||||||
<Style Selector="^:selected">
|
<Style Selector="^:selected">
|
||||||
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
|
<Style Selector="^ /template/ ContentPresenter#PART_HeaderPresenter">
|
||||||
<Setter Property="FontWeight" Value="{DynamicResource TabItemSelectedFontWeight}" />
|
<Setter Property="FontWeight" Value="{DynamicResource TabItemSelectedFontWeight}" />
|
||||||
|
|||||||
@@ -2,7 +2,11 @@
|
|||||||
xmlns="https://github.com/avaloniaui"
|
xmlns="https://github.com/avaloniaui"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
|
||||||
<Design.PreviewWith>
|
<Design.PreviewWith>
|
||||||
<TabbedPage Width="400" Height="300" />
|
<TabbedPage Width="400" Height="800" TabPlacement="Bottom">
|
||||||
|
<ContentPage Icon="{DynamicResource SemiIconHome}" Header="Home" />
|
||||||
|
<ContentPage Icon="{DynamicResource SemiIconSearch}" Header="Search" />
|
||||||
|
<ContentPage Icon="{DynamicResource SemiIconSetting}" Header="Settings" />
|
||||||
|
</TabbedPage>
|
||||||
</Design.PreviewWith>
|
</Design.PreviewWith>
|
||||||
|
|
||||||
<ControlTheme x:Key="{x:Type TabbedPage}" TargetType="TabbedPage">
|
<ControlTheme x:Key="{x:Type TabbedPage}" TargetType="TabbedPage">
|
||||||
@@ -11,27 +15,91 @@
|
|||||||
<TabControl
|
<TabControl
|
||||||
Name="PART_TabControl"
|
Name="PART_TabControl"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
Theme="{StaticResource LineTabControl}" />
|
Theme="{StaticResource LineTabControl}">
|
||||||
|
<TabControl.ItemContainerTheme>
|
||||||
|
<ControlTheme
|
||||||
|
BasedOn="{StaticResource LineTabItem}"
|
||||||
|
TargetType="TabItem">
|
||||||
|
<Style Selector="^[TabStripPlacement=Top], ^[TabStripPlacement=Bottom]">
|
||||||
|
<Setter Property="TabItem.Margin" Value="0" />
|
||||||
|
<Setter Property="TabItem.HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="TabItem.VerticalContentAlignment" Value="Center" />
|
||||||
|
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
|
||||||
|
<Setter Property="DockPanel.Dock" Value="Top" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
</TabControl.ItemContainerTheme>
|
||||||
|
<TabControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<UniformGrid Columns="{Binding $parent[TabControl].ItemCount}" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</TabControl.ItemsPanel>
|
||||||
|
</TabControl>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="CardTabbedPage" TargetType="TabbedPage">
|
<ControlTheme x:Key="CardTabbedPage" TargetType="TabbedPage">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="TabbedPage">
|
<ControlTemplate TargetType="TabbedPage">
|
||||||
<TabControl
|
<TabControl
|
||||||
Name="PART_TabControl"
|
Name="PART_TabControl"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
Theme="{StaticResource CardTabControl}" />
|
Theme="{StaticResource CardTabControl}">
|
||||||
|
<TabControl.ItemContainerTheme>
|
||||||
|
<ControlTheme
|
||||||
|
BasedOn="{StaticResource CardTabItem}"
|
||||||
|
TargetType="TabItem">
|
||||||
|
<Style Selector="^[TabStripPlacement=Top], ^[TabStripPlacement=Bottom]">
|
||||||
|
<Setter Property="TabItem.Padding" Value="8" />
|
||||||
|
<Setter Property="TabItem.Margin" Value="0" />
|
||||||
|
<Setter Property="TabItem.HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="TabItem.VerticalContentAlignment" Value="Center" />
|
||||||
|
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
|
||||||
|
<Setter Property="DockPanel.Dock" Value="Top" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
</TabControl.ItemContainerTheme>
|
||||||
|
<TabControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<UniformGrid Columns="{Binding $parent[TabControl].ItemCount}" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</TabControl.ItemsPanel>
|
||||||
|
</TabControl>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|
||||||
<ControlTheme x:Key="ButtonTabbedPage" TargetType="TabbedPage">
|
<ControlTheme x:Key="ButtonTabbedPage" TargetType="TabbedPage">
|
||||||
<Setter Property="Template">
|
<Setter Property="Template">
|
||||||
<ControlTemplate TargetType="TabbedPage">
|
<ControlTemplate TargetType="TabbedPage">
|
||||||
<TabControl
|
<TabControl
|
||||||
Name="PART_TabControl"
|
Name="PART_TabControl"
|
||||||
Background="{TemplateBinding Background}"
|
Background="{TemplateBinding Background}"
|
||||||
Theme="{StaticResource ButtonTabControl}" />
|
Theme="{StaticResource ButtonTabControl}">
|
||||||
|
<TabControl.ItemContainerTheme>
|
||||||
|
<ControlTheme
|
||||||
|
BasedOn="{StaticResource ButtonTabItem}"
|
||||||
|
TargetType="TabItem">
|
||||||
|
<Style Selector="^[TabStripPlacement=Top], ^[TabStripPlacement=Bottom]">
|
||||||
|
<Setter Property="TabItem.Padding" Value="12" />
|
||||||
|
<Setter Property="TabItem.Margin" Value="0" />
|
||||||
|
<Setter Property="TabItem.HorizontalContentAlignment" Value="Center" />
|
||||||
|
<Setter Property="TabItem.VerticalContentAlignment" Value="Center" />
|
||||||
|
<Style Selector="^ /template/ ContentPresenter#PART_IconPresenter">
|
||||||
|
<Setter Property="DockPanel.Dock" Value="Top" />
|
||||||
|
</Style>
|
||||||
|
</Style>
|
||||||
|
</ControlTheme>
|
||||||
|
</TabControl.ItemContainerTheme>
|
||||||
|
<TabControl.ItemsPanel>
|
||||||
|
<ItemsPanelTemplate>
|
||||||
|
<UniformGrid Columns="{Binding $parent[TabControl].ItemCount}" />
|
||||||
|
</ItemsPanelTemplate>
|
||||||
|
</TabControl.ItemsPanel>
|
||||||
|
</TabControl>
|
||||||
</ControlTemplate>
|
</ControlTemplate>
|
||||||
</Setter>
|
</Setter>
|
||||||
</ControlTheme>
|
</ControlTheme>
|
||||||
|
|||||||
Reference in New Issue
Block a user