Skip to content

Commit

Permalink
Repro
Browse files Browse the repository at this point in the history
  • Loading branch information
wieslawsoltes committed Jun 4, 2023
1 parent febd706 commit fcd8996
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
15 changes: 15 additions & 0 deletions samples/ColorPickerDemo/MainWindow.axaml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:cp="clr-namespace:ThemeEditor.Controls.ColorPicker;assembly=ThemeEditor.Controls.ColorPicker"
xmlns:converters="clr-namespace:ThemeEditor.Controls.ColorPicker.Converters;assembly=ThemeEditor.Controls.ColorPicker"
xmlns:local="clr-namespace:ColorPickerDemo"
mc:Ignorable="d" d:DesignWidth="550" d:DesignHeight="350"
x:Class="ColorPickerDemo.MainWindow"
Expand Down Expand Up @@ -52,6 +53,20 @@
<cp:ColorPicker Color="{Binding NullValue, Mode=TwoWay, Converter={x:Static local:UInt32ToColorConverter.Instance}}"
Margin="12" />
</TabItem>

<TabItem Header="Gradient">
<DockPanel>
<Slider DockPanel.Dock="Top" Value="{Binding Value1}" Minimum="0" Maximum="255" SmallChange="1" LargeChange="1" />
<Grid>
<Grid.Background>
<LinearGradientBrush StartPoint="0%,50%" EndPoint="100%,50%">
<GradientStop Offset="0" Color="#FFFFFFFF" />
<GradientStop Offset="1" Color="{Binding Value1, Converter={x:Static converters:HueToColorConverter.Instance}}" />
</LinearGradientBrush>
</Grid.Background>
</Grid>
</DockPanel>
</TabItem>
</TabControl>
</Panel>
</Window>
10 changes: 10 additions & 0 deletions samples/ColorPickerDemo/MainWindow.axaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,9 @@ public partial class MainWindow : Window
public static readonly StyledProperty<uint?> NullValueProperty =
AvaloniaProperty.Register<MainWindow, uint?>(nameof(NullValue));

public static readonly StyledProperty<double> Value1Property =
AvaloniaProperty.Register<MainWindow, double>(nameof(Value1));

public Color? Color
{
get => GetValue(ColorProperty);
Expand Down Expand Up @@ -61,6 +64,12 @@ public uint? NullValue
set => SetValue(NullValueProperty, value);
}

public double Value1
{
get => GetValue(Value1Property);
set => SetValue(Value1Property, value);
}

public MainWindow()
{
InitializeComponent();
Expand All @@ -72,6 +81,7 @@ public MainWindow()
Value = Colors.Green.ToUInt32();
NullValue = null;
DataContext = this;
Value1 = 0;
}

private void InitializeComponent()
Expand Down

0 comments on commit fcd8996

Please sign in to comment.