Skip to content

Commit

Permalink
Added the possibility to expand code areas in Gradient page (#373)
Browse files Browse the repository at this point in the history
  • Loading branch information
Leo-Peyronnet committed Feb 20, 2024
1 parent 44d10bc commit 9e0ac14
Show file tree
Hide file tree
Showing 2 changed files with 45 additions and 6 deletions.
39 changes: 33 additions & 6 deletions ColorPicker/Pages/GradientPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -609,7 +609,7 @@
<Button
x:Name="CopyCssBtn"
Grid.Column="2"
Margin="10 0"
Margin="5 0"
Padding="5"
VerticalAlignment="Center"
Background="{DynamicResource Background3}"
Expand All @@ -618,9 +618,23 @@
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />
<Button
x:Name="ExpandCssBtn"
Padding="5"
VerticalAlignment="Center"
Background="Transparent"
Click="ExpandCssBtn_Click"
Content="&#xF2A4;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />

</StackPanel>
<Border Background="{DynamicResource Background2}" CornerRadius="5">
<Border
x:Name="CssBorder"
Background="{DynamicResource Background2}"
CornerRadius="5"
Visibility="Collapsed">
<TextBox
x:Name="CssCodeTxt"
Width="210"
Expand All @@ -634,7 +648,7 @@
TextWrapping="WrapWithOverflow" />
</Border>

<StackPanel Margin="0 0 0 10" Orientation="Horizontal">
<StackPanel Margin="0 10 0 10" Orientation="Horizontal">
<TextBlock
Margin="5 0 0 0"
VerticalAlignment="Center"
Expand All @@ -644,7 +658,7 @@
<Button
x:Name="CopyXamlBtn"
Grid.Column="2"
Margin="10 0"
Margin="5 0"
Padding="5"
VerticalAlignment="Center"
Background="{DynamicResource Background3}"
Expand All @@ -653,9 +667,22 @@
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />

<Button
x:Name="ExpandXamlBtn"
Padding="5"
VerticalAlignment="Center"
Background="Transparent"
Click="ExpandXamlBtn_Click"
Content="&#xF2A4;"
FontFamily="..\Fonts\#FluentSystemIcons-Regular"
Foreground="{DynamicResource Foreground1}"
Style="{DynamicResource DefaultButton}" />
</StackPanel>
<Border Background="{DynamicResource Background2}" CornerRadius="5">
<Border
x:Name="XamlBorder"
Background="{DynamicResource Background2}"
CornerRadius="5"
Visibility="Collapsed">
<TextBox
x:Name="XamlCodeTxt"
Width="210"
Expand Down
12 changes: 12 additions & 0 deletions ColorPicker/Pages/GradientPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -445,6 +445,18 @@ private void ForegroundBorder_MouseRightButtonUp(object sender, MouseButtonEvent
new ColorDetailsWindow((SolidColorBrush)((Border)sender).Background).Show();
}

private void ExpandCssBtn_Click(object sender, RoutedEventArgs e)
{
CssBorder.Visibility = CssBorder.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
ExpandCssBtn.Content = CssBorder.Visibility == Visibility.Visible ? "\uF2B7" : "\uF2A4";
}

private void ExpandXamlBtn_Click(object sender, RoutedEventArgs e)
{
XamlBorder.Visibility = XamlBorder.Visibility == Visibility.Visible ? Visibility.Collapsed : Visibility.Visible;
ExpandXamlBtn.Content = XamlBorder.Visibility == Visibility.Visible ? "\uF2B7" : "\uF2A4";
}

private ColorHelper.RGB ConvertToRgb()
{
if (SelectedColorBtn == RgbBtn) return new((byte)int.Parse(Txt1.Text),
Expand Down

0 comments on commit 9e0ac14

Please sign in to comment.