Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Dyn 5716 color picker improvements #13919

Merged
merged 3 commits into from
Apr 24, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
35 changes: 18 additions & 17 deletions src/DynamoCoreWpf/Views/Core/CustomColorPicker.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -301,14 +301,14 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid Grid.Row="0">
<Grid Grid.Row="0" Margin="0,0,0,-15">
<Grid x:Name="titleGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*" />
<ColumnDefinition Width="7*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,20,0,20"
Margin="-4,5,0,20"
Padding="2"
Background="Transparent"
FontFamily="{StaticResource ArtifaktElementRegular}"
Expand All @@ -320,15 +320,15 @@
Grid.Column="1"
Width="12"
Height="12"
Margin="0,0,0,10"
Margin="0,-8,0,10"
Click="CustomColorsCloseButton_Click"
Style="{StaticResource PopupCloseButtonStyle}" />
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="420" />
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="420"/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
Expand All @@ -337,6 +337,7 @@

<!-- Contains all the colors in a Canvas -->
<Border
Margin="0,0,5,0"
Background="{StaticResource CheckerBrush}"
BorderBrush="DarkGray"
BorderThickness="1"
Expand Down Expand Up @@ -415,7 +416,7 @@
x:Name="PART_HexadecimalTextBox"
Grid.Column="1"
MinHeight="22"
Margin="2,0,2,0"
Margin="2,0,5,0"
VerticalAlignment="Center"
FontFamily="{StaticResource ArtifaktElementRegular}"
Style="{StaticResource ColorCanvasTextBoxStyle}" />
Expand All @@ -426,7 +427,7 @@
<Border
Grid.RowSpan="2"
Grid.Column="1"
Margin="4,-8,0,0"
Margin="7,-8,0,0"
ClipToBounds="False">
<xctk:ColorSpectrumSlider x:Name="PART_SpectrumSlider" VerticalAlignment="Stretch" />
</Border>
Expand Down Expand Up @@ -642,7 +643,7 @@
<!-- Normal Colors Window -->
<Grid
x:Name="gridNormalColorSelection"
Margin="20"
Margin="21,10,20,10"
HorizontalAlignment="Left"
Background="Transparent"
Visibility="{Binding Path=IsCustomColorSelectionEnabled, Converter={StaticResource InverseBooleanToVisibilityCollapsedConverter}}">
Expand All @@ -659,18 +660,16 @@
<Grid Grid.Row="0">
<Grid x:Name="titleCustomColorsGrid">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="10*" />
<ColumnDefinition Width="20*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<TextBlock
Margin="0,10,0,10"
Padding="2"
Background="Transparent"
Margin="0"
FontFamily="{StaticResource ArtifaktElementRegular}"
FontSize="20"
FontWeight="Bold"
Foreground="Black"
Text="{x:Static p:Resources.CustomColorPickerTitle}" />
Text="{x:Static p:Resources.CustomColorPickerTitle}"/>
<Button
Name="NormalColorsCloseButton"
Grid.Column="1"
Expand All @@ -695,6 +694,7 @@
Margin="0,10,0,0"
Padding="2"
Background="Transparent"
FontSize="14"
FontFamily="{StaticResource ArtifaktElementRegular}"
Foreground="Black"
Text="{x:Static p:Resources.CustomColorPickerBasicColors}" />
Expand All @@ -719,10 +719,11 @@
</Grid.RowDefinitions>
<TextBlock
Grid.Row="0"
Margin="0,10,0,0"
Margin="0,10,0,-9"
Padding="2"
Background="Transparent"
FontFamily="{StaticResource ArtifaktElementRegular}"
FontSize="14"
Foreground="Black"
Text="{x:Static p:Resources.CustomColorPickerCustomColors}" />

Expand All @@ -741,7 +742,7 @@
<Button
x:Name="DefineColorBtn"
MaxWidth="200"
Margin="2,0,0,0"
Margin="3,0,0,0"
Padding="10"
HorizontalAlignment="Left"
Click="DefineColorBtn_Click"
Expand All @@ -761,7 +762,7 @@

<!-- Buttons -->
<Grid Grid.Row="5" HorizontalAlignment="Right">
<Grid Margin="10,10,0,0">
<Grid Margin="10,7,0,0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
<ColumnDefinition Width="Auto" />
Expand Down
16 changes: 16 additions & 0 deletions src/Libraries/CoreNodeModelsWpf/ColorPaletteViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ namespace Dynamo.Wpf
internal class ColorPaletteViewModel : NotificationObject
{
private SolidColorBrush selectedColor;
private string selectedColorValue;
private bool isColorPickerShown;

/// <summary>
Expand All @@ -23,6 +24,21 @@ public SolidColorBrush SelectedColor
RaisePropertyChanged(nameof(SelectedColor));
}
}
/// <summary>
/// This property will contain the selected color value in the CustomColorPicker popup
/// </summary>
public string SelectedColorValue
{
get
{
return selectedColorValue;
}
set
{
selectedColorValue = value;
RaisePropertyChanged(nameof(SelectedColorValue));
}
}

/// <summary>
/// When the Color Picker is opened this value will have true otherwise will be false, this helps to control the arrow color in the ToggleButton
Expand Down
6 changes: 5 additions & 1 deletion src/Libraries/CoreNodeModelsWpf/Controls/ColorPalette.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@
Height="25"
Click="ColorToggleButton_Click"
IsChecked="{Binding IsColorPickerShown}"
Style="{StaticResource CustomColorToggle}" />
Style="{StaticResource CustomColorToggle}">
<ToggleButton.ToolTip>
<ToolTip Content="{Binding SelectedColorValue, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"/>
</ToggleButton.ToolTip>
</ToggleButton>
</Grid>
</UserControl>
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ private void ColorPaletteNode_PropertyChanged(object sender, PropertyChangedEven
if (!isSameColor)
{
colorPaletteViewModel.SelectedColor = new SolidColorBrush(convertedModelColor);
colorPaletteViewModel.SelectedColorValue = colorPaletteViewModel.SelectedColor.ToString();
}
}
}
Expand Down