mirror of
https://github.com/microsoft/PowerToys.git
synced 2026-04-05 10:46:33 +02:00
[Settings] Custom color format UI tweaks (#22790)
* Custom color format tweaks * Delete vs. remove * Update expect.txt * [ColorPicker]Support BGR and RGB decimal value formats (#22771) * ColorPicker add both decimal value formats * ColorPicker, custom format dialog, resizing columns * Custom color format tweaks * Delete vs. remove * Update expect.txt * Fix rebase * Fix error
This commit is contained in:
@@ -3,13 +3,15 @@
|
||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||
xmlns:controls="using:Microsoft.PowerToys.Settings.UI.Controls"
|
||||
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
|
||||
xmlns:labs="using:CommunityToolkit.Labs.WinUI"
|
||||
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
||||
xmlns:converters="using:CommunityToolkit.WinUI.UI.Converters"
|
||||
xmlns:models="using:Microsoft.PowerToys.Settings.UI.Library" xmlns:viewmodels="using:Microsoft.PowerToys.Settings.UI.ViewModels" d:DataContext="{d:DesignInstance Type=viewmodels:ColorPickerViewModel}"
|
||||
xmlns:models="using:Microsoft.PowerToys.Settings.UI.Library"
|
||||
xmlns:ui="using:CommunityToolkit.WinUI.UI"
|
||||
xmlns:viewmodels="using:Microsoft.PowerToys.Settings.UI.ViewModels"
|
||||
x:Name="RootPage"
|
||||
d:DataContext="{d:DesignInstance Type=viewmodels:ColorPickerViewModel}"
|
||||
AutomationProperties.LandmarkType="Main"
|
||||
mc:Ignorable="d">
|
||||
|
||||
@@ -17,21 +19,15 @@
|
||||
<converters:BoolToVisibilityConverter x:Key="BoolToVis" />
|
||||
</Page.Resources>
|
||||
|
||||
<controls:SettingsPageControl
|
||||
x:Uid="ColorPicker"
|
||||
ModuleImageSource="ms-appx:///Assets/Modules/ColorPicker.png">
|
||||
<controls:SettingsPageControl x:Uid="ColorPicker" ModuleImageSource="ms-appx:///Assets/Modules/ColorPicker.png">
|
||||
<controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
<StackPanel
|
||||
x:Name="ColorPickerView"
|
||||
Orientation="Vertical">
|
||||
<StackPanel x:Name="ColorPickerView" Orientation="Vertical">
|
||||
<labs:SettingsCard
|
||||
x:Uid="ColorPicker_EnableColorPicker"
|
||||
HeaderIcon="{ui:BitmapIcon Source=/Assets/FluentIcons/FluentIconsColorPicker.png}"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured, Converter={StaticResource BoolNegationConverter}}">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{x:Bind ViewModel.IsEnabled, Mode=TwoWay}" />
|
||||
</labs:SettingsCard>
|
||||
<InfoBar
|
||||
x:Uid="GPO_IsSettingForced"
|
||||
@@ -40,25 +36,13 @@
|
||||
IsTabStop="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabledGpoConfigured}"
|
||||
Severity="Informational" />
|
||||
|
||||
<controls:SettingsGroup
|
||||
x:Uid="Shortcut"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<labs:SettingsCard
|
||||
x:Uid="Activation_Shortcut"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
Glyph=}">
|
||||
<controls:ShortcutControl
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
|
||||
<controls:SettingsGroup x:Uid="Shortcut" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<labs:SettingsCard x:Uid="Activation_Shortcut" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}">
|
||||
<controls:ShortcutControl MinWidth="{StaticResource SettingActionControlMinWidth}" HotkeySettings="{x:Bind Path=ViewModel.ActivationShortcut, Mode=TwoWay}" />
|
||||
</labs:SettingsCard>
|
||||
|
||||
<labs:SettingsCard
|
||||
x:Uid="ColorPicker_ActivationAction"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
Glyph=}">
|
||||
<ComboBox
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
SelectedIndex="{x:Bind Path=ViewModel.ActivationBehavior, Mode=TwoWay}">
|
||||
<labs:SettingsCard x:Uid="ColorPicker_ActivationAction" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}">
|
||||
<ComboBox MinWidth="{StaticResource SettingActionControlMinWidth}" SelectedIndex="{x:Bind Path=ViewModel.ActivationBehavior, Mode=TwoWay}">
|
||||
<ComboBoxItem x:Uid="EditorFirst" />
|
||||
<ComboBoxItem x:Uid="ColorPickerFirst" />
|
||||
<ComboBoxItem x:Uid="ColorPickerOnly" />
|
||||
@@ -67,13 +51,8 @@
|
||||
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup
|
||||
x:Uid="ColorFormats"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<labs:SettingsCard
|
||||
x:Uid="ColorPicker_CopiedColorRepresentation"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
Glyph=}">
|
||||
<controls:SettingsGroup x:Uid="ColorFormats" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<labs:SettingsCard x:Uid="ColorPicker_CopiedColorRepresentation" HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily}, Glyph=}">
|
||||
<ComboBox
|
||||
x:Name="ColorPicker_ComboBox"
|
||||
MinWidth="{StaticResource SettingActionControlMinWidth}"
|
||||
@@ -86,9 +65,7 @@
|
||||
</labs:SettingsCard>
|
||||
|
||||
<labs:SettingsCard x:Uid="ColorPicker_ShowColorName">
|
||||
<ToggleSwitch
|
||||
x:Uid="ToggleSwitch"
|
||||
IsOn="{Binding ShowColorName, Mode=TwoWay}" />
|
||||
<ToggleSwitch x:Uid="ToggleSwitch" IsOn="{Binding ShowColorName, Mode=TwoWay}" />
|
||||
</labs:SettingsCard>
|
||||
<!--
|
||||
Disabling this until we have a safer way to reset cursor as
|
||||
@@ -101,20 +78,17 @@
|
||||
-->
|
||||
</controls:SettingsGroup>
|
||||
|
||||
<controls:SettingsGroup
|
||||
x:Uid="ColorPicker_Editor"
|
||||
IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<controls:SettingsGroup x:Uid="ColorPicker_Editor" IsEnabled="{x:Bind Mode=OneWay, Path=ViewModel.IsEnabled}">
|
||||
<labs:SettingsCard
|
||||
x:Name="ColorFormatsSetting"
|
||||
x:Uid="ColorPicker_ColorFormats"
|
||||
HeaderIcon="{ui:FontIcon FontFamily={StaticResource SymbolThemeFontFamily},
|
||||
Glyph=}" >
|
||||
Glyph=}">
|
||||
<Button
|
||||
x:Uid="ColorPickerAddNewFormat"
|
||||
Click="NewFormatClick"
|
||||
Style="{StaticResource AccentButtonStyle}"
|
||||
HorizontalAlignment="Right"
|
||||
/>
|
||||
Click="NewFormatClick"
|
||||
Style="{StaticResource AccentButtonStyle}" />
|
||||
</labs:SettingsCard>
|
||||
<!-- Disabled reordering by dragging -->
|
||||
<!-- CanReorderItems="True" AllowDrop="True" -->
|
||||
@@ -126,61 +100,26 @@
|
||||
<DataTemplate x:DataType="models:ColorFormatModel">
|
||||
<labs:SettingsCard
|
||||
Margin="0,0,0,2"
|
||||
Click="EditButton_Click"
|
||||
Description="{x:Bind Example, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Header="{x:Bind Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
Header="{x:Bind Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
IsClickEnabled="True">
|
||||
<labs:SettingsCard.Resources>
|
||||
<x:Double x:Key="SettingsCardLeftIndention">42</x:Double>
|
||||
<x:Double x:Key="SettingsCardActionButtonWidth">0</x:Double>
|
||||
</labs:SettingsCard.Resources>
|
||||
<Grid
|
||||
HorizontalAlignment="Right"
|
||||
ColumnSpacing="8">
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="Auto" />
|
||||
<ColumnDefinition Width="Auto" />
|
||||
</Grid.ColumnDefinitions>
|
||||
<Button
|
||||
x:Uid="EditButton"
|
||||
Background="Transparent"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
Grid.RowSpan="2"
|
||||
Width="40"
|
||||
Height="36"
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,160,0"
|
||||
Content=""
|
||||
Click="EditButton_Click">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="EditTooltip"/>
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
<Button x:Name="RemoveButton"
|
||||
x:Uid="RemoveButton"
|
||||
Background="Transparent"
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
Grid.RowSpan="2"
|
||||
Width="40"
|
||||
Height="36"
|
||||
Content=""
|
||||
HorizontalAlignment="Right"
|
||||
Margin="0,0,104,0"
|
||||
IsEnabled="{x:Bind CanBeDeleted, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
Click="RemoveButton_Click">
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="RemoveTooltip"/>
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
<StackPanel Orientation="Horizontal" Spacing="4">
|
||||
<ToggleSwitch
|
||||
x:Uid="Enable_ColorFormat"
|
||||
HorizontalAlignment="Right"
|
||||
AutomationProperties.HelpText="{x:Bind Name}"
|
||||
IsOn="{x:Bind IsShown, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
OffContent=""
|
||||
OnContent="" />
|
||||
|
||||
<Button
|
||||
x:Uid="More_Options_Button"
|
||||
Grid.Column="1"
|
||||
VerticalAlignment="Center"
|
||||
Background="Transparent"
|
||||
Content=""
|
||||
FontFamily="{ThemeResource SymbolThemeFontFamily}"
|
||||
Style="{StaticResource SubtleButtonStyle}">
|
||||
@@ -202,13 +141,23 @@
|
||||
<FontIcon Glyph="" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
<MenuFlyoutSeparator />
|
||||
<MenuFlyoutItem
|
||||
x:Uid="RemoveItem"
|
||||
Click="RemoveButton_Click"
|
||||
IsEnabled="{x:Bind CanBeDeleted, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
<MenuFlyoutItem.Icon>
|
||||
<FontIcon Glyph="" />
|
||||
</MenuFlyoutItem.Icon>
|
||||
</MenuFlyoutItem>
|
||||
|
||||
</MenuFlyout>
|
||||
</Button.Flyout>
|
||||
<ToolTipService.ToolTip>
|
||||
<TextBlock x:Uid="More_Options_ButtonTooltip" />
|
||||
</ToolTipService.ToolTip>
|
||||
</Button>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
</labs:SettingsCard>
|
||||
</DataTemplate>
|
||||
</ItemsControl.ItemTemplate>
|
||||
@@ -217,172 +166,29 @@
|
||||
<ContentDialog
|
||||
x:Name="ColorFormatDialog"
|
||||
x:Uid="ColorFormatDialog"
|
||||
IsPrimaryButtonEnabled="{Binding IsValid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
|
||||
PrimaryButtonStyle="{ThemeResource AccentButtonStyle}"
|
||||
SecondaryButtonClick="ColorFormatDialog_CancelButtonClick"
|
||||
IsPrimaryButtonEnabled="{Binding IsValid, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}">
|
||||
SecondaryButtonClick="ColorFormatDialog_CancelButtonClick">
|
||||
<ContentDialog.DataContext>
|
||||
<models:ColorFormatModel />
|
||||
</ContentDialog.DataContext>
|
||||
<ScrollViewer HorizontalScrollMode="Auto" HorizontalScrollBarVisibility="Auto">
|
||||
<StackPanel
|
||||
Margin="0,12,0,0"
|
||||
HorizontalAlignment="Stretch"
|
||||
Spacing="24">
|
||||
<TextBox
|
||||
x:Uid="NewColorName"
|
||||
x:Name="NewColorName"
|
||||
IsSpellCheckEnabled="False"
|
||||
TextChanged="NewColorName_TextChanged"
|
||||
Text="{Binding Name, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<TextBox
|
||||
x:Uid="NewColorFormat"
|
||||
Name="NewColorFormat"
|
||||
IsSpellCheckEnabled="False"
|
||||
TextChanged="NewColorFormat_TextChanged"
|
||||
Text="{Binding Format, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}" />
|
||||
<!-- The help block -->
|
||||
<Grid>
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="30"/>
|
||||
<RowDefinition />
|
||||
<RowDefinition Height="30"/>
|
||||
</Grid.RowDefinitions>
|
||||
<TextBlock x:Uid="HelpLine1"/>
|
||||
<Grid Grid.Row="1">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="37px"/>
|
||||
<ColumnDefinition Width="127px"/>
|
||||
<ColumnDefinition Width="37px"/>
|
||||
<ColumnDefinition Width="127px"/>
|
||||
<ColumnDefinition Width="37px"/>
|
||||
<ColumnDefinition Width="127px"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text = "%Re" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_red" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Gr" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_green" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Bl" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_blue" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Al" Grid.Row="1" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_alpha" Grid.Row="1" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Cy" Grid.Row="1" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_cyan" Grid.Row="1" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Ma" Grid.Row="1" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_magenta" Grid.Row="1" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Ye" Grid.Row="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_yellow" Grid.Row="2" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Bk" Grid.Row="2" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_black_key" Grid.Row="2" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Hu" Grid.Row="2" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_hue" Grid.Row="2" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Si" Grid.Row="3" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_saturationI" Grid.Row="3" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Sl" Grid.Row="3" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_saturationL" Grid.Row="3" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Sb" Grid.Row="3" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_saturationB" Grid.Row="3" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Br" Grid.Row="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_brightness" Grid.Row="4" Grid.Column="1"/>
|
||||
<TextBlock Text = "%In" Grid.Row="4" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_intensity" Grid.Row="4" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Hn" Grid.Row="4" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_hueNat" Grid.Row="4" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Ll" Grid.Row="5" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_lightnessNat" Grid.Row="5" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Lc" Grid.Row="5" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_lightnessCIE" Grid.Row="5" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Va" Grid.Row="5" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_value" Grid.Row="5" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Wh" Grid.Row="6" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_whiteness" Grid.Row="6" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Bn" Grid.Row="6" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_blackness" Grid.Row="6" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Ca" Grid.Row="6" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_chromaticityA" Grid.Row="6" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Cb" Grid.Row="7" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_chromaticityB" Grid.Row="7" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Xv" Grid.Row="7" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_X_value" Grid.Row="7" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Yv" Grid.Row="7" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_Y_value" Grid.Row="7" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Zv" Grid.Row="8" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_Z_value" Grid.Row="8" Grid.Column="1"/>
|
||||
<TextBlock Text = "%Dv" Grid.Row="8" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_decimal_value_BGR" Grid.Row="8" Grid.Column="3"/>
|
||||
<TextBlock Text = "%Dr" Grid.Row="8" Grid.Column="4" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_decimal_value_RGB" Grid.Row="8" Grid.Column="5"/>
|
||||
<TextBlock Text = "%Na" Grid.Row="9" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_color_name" Grid.Row="9" Grid.Column="1"/>
|
||||
</Grid>
|
||||
<TextBlock
|
||||
Grid.Row="2"
|
||||
x:Uid="HelpLine2"
|
||||
VerticalAlignment="Bottom"/>
|
||||
<Grid Grid.Row="3">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
<RowDefinition />
|
||||
</Grid.RowDefinitions>
|
||||
<Grid.ColumnDefinitions>
|
||||
<ColumnDefinition Width="40px"/>
|
||||
<ColumnDefinition Width="200px"/>
|
||||
<ColumnDefinition Width="40px"/>
|
||||
<ColumnDefinition Width="200px"/>
|
||||
</Grid.ColumnDefinitions>
|
||||
<TextBlock Text = "b" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid="Help_byte" Grid.Column="1"/>
|
||||
<TextBlock Text = "h" Grid.Row="1" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid = "Help_hexL1" Grid.Row="1" Grid.Column="1"/>
|
||||
<TextBlock Text = "H" Grid.Row="1" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid = "Help_hexU1" Grid.Row="1" Grid.Column="3"/>
|
||||
<TextBlock Text = "x" Grid.Row="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid = "Help_hexL2" Grid.Row="2" Grid.Column="1"/>
|
||||
<TextBlock Text = "X" Grid.Row="2" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid = "Help_hexU2" Grid.Row="2" Grid.Column="3"/>
|
||||
<TextBlock Text = "f" Grid.Row="3" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid = "Help_floatWith" Grid.Row="3" Grid.Column="1"/>
|
||||
<TextBlock Text = "F" Grid.Row="3" Grid.Column="2" FontWeight="Bold"/>
|
||||
<TextBlock x:Uid = "Help_floatWithout" Grid.Row="3" Grid.Column="3"/>
|
||||
</Grid>
|
||||
<TextBlock
|
||||
Grid.Row="4"
|
||||
x:Uid = "HelpLine3"
|
||||
VerticalAlignment="Bottom"/>
|
||||
</Grid>
|
||||
</StackPanel>
|
||||
<ScrollViewer HorizontalScrollBarVisibility="Auto" HorizontalScrollMode="Auto">
|
||||
<controls:ColorFormatEditor
|
||||
Width="480"
|
||||
Margin="2,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
PropertyChanged="ColorFormatEditor_PropertyChanged" />
|
||||
</ScrollViewer>
|
||||
</ContentDialog>
|
||||
</StackPanel>
|
||||
</controls:SettingsPageControl.ModuleContent>
|
||||
|
||||
<controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:PageLink
|
||||
x:Uid="LearnMore_ColorPicker"
|
||||
Link="https://aka.ms/PowerToysOverview_ColorPicker" />
|
||||
<controls:PageLink x:Uid="LearnMore_ColorPicker" Link="https://aka.ms/PowerToysOverview_ColorPicker" />
|
||||
</controls:SettingsPageControl.PrimaryLinks>
|
||||
<controls:SettingsPageControl.SecondaryLinks>
|
||||
<controls:PageLink
|
||||
Link="https://github.com/martinchrzan/ColorPicker/"
|
||||
Text="Martin Chrzan's Color Picker" />
|
||||
<controls:PageLink
|
||||
Link="https://medium.com/@Niels9001/a-fluent-color-meter-for-powertoys-20407ededf0c"
|
||||
Text="Niels Laute's UX concept" />
|
||||
<controls:PageLink Link="https://github.com/martinchrzan/ColorPicker/" Text="Martin Chrzan's Color Picker" />
|
||||
<controls:PageLink Link="https://medium.com/@Niels9001/a-fluent-color-meter-for-powertoys-20407ededf0c" Text="Niels Laute's UX concept" />
|
||||
</controls:SettingsPageControl.SecondaryLinks>
|
||||
</controls:SettingsPageControl>
|
||||
</Page>
|
||||
@@ -4,10 +4,13 @@
|
||||
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Globalization;
|
||||
using System.Windows.Input;
|
||||
using CommunityToolkit.Labs.WinUI;
|
||||
using ManagedCommon;
|
||||
using Microsoft.PowerToys.Settings.UI.Helpers;
|
||||
using Microsoft.PowerToys.Settings.UI.Library;
|
||||
using Microsoft.PowerToys.Settings.UI.Library.Utilities;
|
||||
using Microsoft.PowerToys.Settings.UI.ViewModels;
|
||||
using Microsoft.UI.Xaml.Controls;
|
||||
using Windows.ApplicationModel.Resources;
|
||||
@@ -23,6 +26,8 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
|
||||
public ICommand UpdateCommand => new RelayCommand(Update);
|
||||
|
||||
private ResourceLoader resourceLoader = ResourceLoader.GetForViewIndependentUse();
|
||||
|
||||
public ColorPickerPage()
|
||||
{
|
||||
var settingsUtils = new SettingsUtils();
|
||||
@@ -81,6 +86,24 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
}
|
||||
}
|
||||
|
||||
private async void RemoveButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
ColorFormatModel color = ((MenuFlyoutItem)sender).DataContext as ColorFormatModel;
|
||||
|
||||
ContentDialog dialog = new ContentDialog();
|
||||
dialog.XamlRoot = RootPage.XamlRoot;
|
||||
dialog.Title = color.Name;
|
||||
dialog.PrimaryButtonText = resourceLoader.GetString("Yes");
|
||||
dialog.CloseButtonText = resourceLoader.GetString("No");
|
||||
dialog.DefaultButton = ContentDialogButton.Primary;
|
||||
dialog.Content = new TextBlock() { Text = resourceLoader.GetString("Delete_Dialog_Description") };
|
||||
dialog.PrimaryButtonClick += (s, args) =>
|
||||
{
|
||||
ViewModel.DeleteModel(color);
|
||||
};
|
||||
var result = await dialog.ShowAsync();
|
||||
}
|
||||
|
||||
private void Add()
|
||||
{
|
||||
ColorFormatModel newColorFormat = ColorFormatDialog.DataContext as ColorFormatModel;
|
||||
@@ -98,12 +121,11 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
|
||||
private async void NewFormatClick(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
var resourceLoader = ResourceLoader.GetForViewIndependentUse();
|
||||
ColorFormatDialog.Title = resourceLoader.GetString("AddCustomColorFormat");
|
||||
ColorFormatModel newColorFormatModel = ViewModel.GetNewColorFormatModel();
|
||||
ColorFormatDialog.DataContext = newColorFormatModel;
|
||||
ColorFormatDialog.Tag = string.Empty;
|
||||
NewColorFormat.Description = " " + ColorFormatHelper.GetStringRepresentation(null, newColorFormatModel.Format);
|
||||
|
||||
ColorFormatDialog.PrimaryButtonText = resourceLoader.GetString("ColorFormatSave");
|
||||
ColorFormatDialog.PrimaryButtonCommand = AddCommand;
|
||||
await ColorFormatDialog.ShowAsync();
|
||||
@@ -122,36 +144,22 @@ namespace Microsoft.PowerToys.Settings.UI.Views
|
||||
ColorFormatDialog.Hide();
|
||||
}
|
||||
|
||||
private void NewColorFormat_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
NewColorFormat.Description = " " + ColorFormatHelper.GetStringRepresentation(null, NewColorFormat.Text);
|
||||
ViewModel.SetValidity(ColorFormatDialog.DataContext as ColorFormatModel, ColorFormatDialog.Tag as string);
|
||||
}
|
||||
|
||||
private void NewColorName_TextChanged(object sender, TextChangedEventArgs e)
|
||||
{
|
||||
ViewModel.SetValidity(ColorFormatDialog.DataContext as ColorFormatModel, ColorFormatDialog.Tag as string);
|
||||
}
|
||||
|
||||
private void RemoveButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
Button btn = sender as Button;
|
||||
ColorFormatModel colorFormatModel = btn.DataContext as ColorFormatModel;
|
||||
ViewModel.DeleteModel(colorFormatModel);
|
||||
}
|
||||
|
||||
private async void EditButton_Click(object sender, Microsoft.UI.Xaml.RoutedEventArgs e)
|
||||
{
|
||||
var resourceLoader = ResourceLoader.GetForViewIndependentUse();
|
||||
Button btn = sender as Button;
|
||||
SettingsCard btn = sender as SettingsCard;
|
||||
ColorFormatModel colorFormatModel = btn.DataContext as ColorFormatModel;
|
||||
ColorFormatDialog.Title = resourceLoader.GetString("EditCustomColorFormat");
|
||||
ColorFormatDialog.DataContext = colorFormatModel;
|
||||
ColorFormatDialog.Tag = new KeyValuePair<string, string>(colorFormatModel.Name, colorFormatModel.Format);
|
||||
NewColorFormat.Description = " " + ColorFormatHelper.GetStringRepresentation(null, colorFormatModel.Format);
|
||||
|
||||
ColorFormatDialog.PrimaryButtonText = resourceLoader.GetString("ColorFormatUpdate");
|
||||
ColorFormatDialog.PrimaryButtonCommand = UpdateCommand;
|
||||
await ColorFormatDialog.ShowAsync();
|
||||
}
|
||||
|
||||
private void ColorFormatEditor_PropertyChanged(object sender, EventArgs e)
|
||||
{
|
||||
ColorFormatDialog.IsPrimaryButtonEnabled = ViewModel.SetValidity(ColorFormatDialog.DataContext as ColorFormatModel, ColorFormatDialog.Tag as string);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user