Added Acrylic Sample
This commit is contained in:
Родитель
5afbc90e06
Коммит
d2d3ba6b29
|
@ -15,6 +15,7 @@ namespace FluentEditor.ControlPalette
|
|||
|
||||
public class ColorMapping
|
||||
{
|
||||
private bool initialized = false;
|
||||
public static ColorMapping Parse(JsonObject data, IColorPaletteEntry lightRegion, IColorPaletteEntry darkRegion, ColorPalette lightBase, ColorPalette darkBase, ColorPalette lightPrimary, ColorPalette darkPrimary, IColorPaletteEntry white, IColorPaletteEntry black)
|
||||
{
|
||||
var target = data["Target"].GetEnum<ColorTarget>();
|
||||
|
@ -205,6 +206,37 @@ namespace FluentEditor.ControlPalette
|
|||
ForceThemeUpdateInLinkedElement();
|
||||
}
|
||||
|
||||
private void UpdateAcrylicSurfaceVisual()
|
||||
{
|
||||
if (_targetResources == null || _targetResources.BaseLow == null || _targetResources.ChromeMediumLow == null)
|
||||
{
|
||||
return;
|
||||
}
|
||||
|
||||
App.Current.Resources["SystemAccentColor"] = _targetResources.Accent;
|
||||
|
||||
if (IsSettingDarkColors(_source.Title, "Light Base"))
|
||||
{
|
||||
App.Current.Resources["SystemChromeAltHighColor"] = _targetResources.BaseLow;
|
||||
App.Current.Resources["SystemChromeMediumColor"] = _targetResources.BaseLow;
|
||||
}
|
||||
|
||||
if (IsSettingDarkColors(_source.Title, "Dark Base"))
|
||||
{
|
||||
App.Current.Resources["SystemChromeAltHighColor_Dark"] = _targetResources.ChromeMediumLow;
|
||||
App.Current.Resources["SystemChromeMediumColor_Dark"] = _targetResources.ChromeMediumLow;
|
||||
}
|
||||
}
|
||||
|
||||
private bool IsSettingDarkColors(string title, string themeType)
|
||||
{
|
||||
string[] splitTitle = title.Split(new string[] { themeType }, StringSplitOptions.None);
|
||||
|
||||
if (splitTitle[0] == "")
|
||||
return true;
|
||||
return false;
|
||||
}
|
||||
|
||||
public void Dispose()
|
||||
{
|
||||
_source.ActiveColorChanged -= Source_ActiveColorChanged;
|
||||
|
@ -231,7 +263,7 @@ namespace FluentEditor.ControlPalette
|
|||
_targetResources.AltLow = _source.ActiveColor;
|
||||
break;
|
||||
case ColorTarget.AltMedium:
|
||||
_targetResources.AltMedium = _source.ActiveColor;
|
||||
_targetResources.AltMedium = _source.ActiveColor;
|
||||
break;
|
||||
case ColorTarget.AltMediumHigh:
|
||||
_targetResources.AltMediumHigh = _source.ActiveColor;
|
||||
|
@ -300,6 +332,8 @@ namespace FluentEditor.ControlPalette
|
|||
_targetResources.ListMedium = _source.ActiveColor;
|
||||
break;
|
||||
}
|
||||
|
||||
UpdateAcrylicSurfaceVisual();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -168,6 +168,12 @@
|
|||
x:Uid="TestContentCalendarViewBlock"
|
||||
Margin="0,0,0,16"
|
||||
Style="{StaticResource BaseTextBlockStyle}" />
|
||||
<Grid HorizontalAlignment="Stretch" Height="120" Background="{ThemeResource SystemControlAcrylicWindowBrush}" Margin="0, 0, 0, 16">
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Text="Base Acrylic" FontStyle="Italic" Margin="5"/>
|
||||
</Grid>
|
||||
<Grid HorizontalAlignment="Stretch" Height="120" Background="{ThemeResource SystemControlAccentAcrylicWindowAccentMediumHighBrush}" Margin="0, 0, 0, 16">
|
||||
<TextBlock HorizontalAlignment="Left" VerticalAlignment="Top" Text="Primary Acrylic" FontStyle="Italic" Margin="5" RequestedTheme="Dark"/>
|
||||
</Grid>
|
||||
<CalendarView Margin="0,0,0,28" HorizontalAlignment="Stretch" BorderThickness="{ThemeResource DatePickerBorderThemeThickness}"/>
|
||||
|
||||
</StackPanel>
|
||||
|
|
|
@ -214,7 +214,8 @@
|
|||
<TextBlock
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="Font Here"/>
|
||||
Text="Coming Soon!"
|
||||
Margin="0, 10, 0, 0"/>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
|
@ -226,178 +227,186 @@
|
|||
Orientation="Vertical">
|
||||
|
||||
<ComboBox
|
||||
Header="Presets"
|
||||
Header="Shape Presets"
|
||||
BorderThickness="1"
|
||||
Margin="0, 10, 0, 0"
|
||||
CornerRadius="2"
|
||||
SelectedIndex="1"
|
||||
SelectedIndex="0"
|
||||
HorizontalAlignment="Stretch"
|
||||
VerticalAlignment="Top">
|
||||
<ComboBoxItem>No Rounding, Thicker Borders</ComboBoxItem>
|
||||
VerticalAlignment="Top"
|
||||
SelectionChanged="ComboBox_SelectionChanged">
|
||||
<ComboBoxItem>Default</ComboBoxItem>
|
||||
<ComboBoxItem>No Rounding, Thicker Borders</ComboBoxItem>
|
||||
</ComboBox>
|
||||
|
||||
<TextBlock
|
||||
Margin="0, 25, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="Control Corner Radius"
|
||||
Text="Corner Radius"
|
||||
FontWeight="SemiBold"
|
||||
LineHeight="20"/>
|
||||
<Slider x:Name="ControlRoundSlider" ValueChanged="ControlRoundSlider_ValueChanged" Maximum="20" Minimum="0" Value="2" HorizontalAlignment="Stretch"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="13">
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopLeftTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBox_LostFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
<!-- START -->
|
||||
<StackPanel
|
||||
BorderThickness="1"
|
||||
BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
Padding="5"
|
||||
CornerRadius="2" >
|
||||
<TextBlock
|
||||
Margin="0, 5, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="Controls"
|
||||
FontSize="12"/>
|
||||
<Slider x:Name="ControlRoundSlider" Maximum="20" Minimum="0" Value="2" HorizontalAlignment="Stretch"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="9">
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopLeftTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopRightTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomRightTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomLeftTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopRightTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBox_LostFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomRightTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBox_LostFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomLeftTB"
|
||||
Text="{Binding Value, ElementName=ControlRoundSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBox_LostFocus"
|
||||
KeyDown="TextBox_KeyDown"/>
|
||||
|
||||
<TextBlock
|
||||
Margin="0, 15, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="Overlays"
|
||||
FontSize="12"/>
|
||||
<Slider x:Name="ControlRoundSliderOverlay"
|
||||
ValueChanged="ControlRoundSliderOverlay_ValueChanged"
|
||||
Maximum="20" Minimum="0" Value="4" HorizontalAlignment="Stretch"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="9">
|
||||
<StackPanel>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopLeftTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopRightTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomRightTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomLeftTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<!-- END -->
|
||||
|
||||
<TextBlock
|
||||
Margin="0, 25, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="Overlay Corner Radius"
|
||||
Text="Border Thickness"
|
||||
FontWeight="SemiBold"
|
||||
LineHeight="20"/>
|
||||
<Slider x:Name="ControlRoundSliderOverlay"
|
||||
ValueChanged="ControlRoundSliderOverlay_ValueChanged"
|
||||
Maximum="20" Minimum="0" Value="4" HorizontalAlignment="Stretch"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="13">
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28" Margin="0, 0, 0, 3"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopLeftTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxOverlay_LostFocus"
|
||||
KeyDown="TextBoxOverlay_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28" Margin="0, 0, 0, 3"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopRightTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxOverlay_LostFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28" Margin="0, 0, 0, 3"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomRightTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxOverlay_LostFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28" Margin="0, 0, 0, 3"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomLeftTBOverlay"
|
||||
Text="{Binding Value, ElementName=ControlRoundSliderOverlay, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxOverlay_LostFocus"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
|
||||
<TextBlock
|
||||
Margin="0, 25, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
HorizontalAlignment="Stretch"
|
||||
Text="Control Border Thickness"
|
||||
FontWeight="SemiBold"
|
||||
LineHeight="20"/>
|
||||
<Slider x:Name="ControlBorderThicknessSlider"
|
||||
ValueChanged="ControlBorderThicknessSlider_ValueChanged"
|
||||
Maximum="5" Minimum="0" Value="1" HorizontalAlignment="Stretch"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="13">
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="LeftBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxBorder_LostFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxBorder_LostFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="RightBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxBorder_LostFocus"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
LostFocus="TextBoxBorder_LostFocus"/>
|
||||
|
||||
<!-- START 2 -->
|
||||
<StackPanel BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
BorderThickness="1"
|
||||
CornerRadius="2"
|
||||
Padding="5">
|
||||
<Slider x:Name="ControlBorderThicknessSlider"
|
||||
Maximum="5" Minimum="0" Value="1" HorizontalAlignment="Stretch"/>
|
||||
<StackPanel Orientation="Horizontal" Spacing="9">
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="LeftBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBoxBorder_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="TopBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBoxBorder_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="RightBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBoxBorder_KeyDown"/>
|
||||
</StackPanel>
|
||||
<StackPanel>
|
||||
<FontIcon Glyph="" FontSize="28"/>
|
||||
<TextBox CornerRadius="2" BorderThickness="1"
|
||||
x:Name="BottomBorderTB"
|
||||
Text="{Binding Value, ElementName=ControlBorderThicknessSlider, Mode=OneWay}"
|
||||
MaxLength="2"
|
||||
Width="54"
|
||||
GotFocus="TextBox_GotFocus"
|
||||
KeyDown="TextBoxBorder_KeyDown"/>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
</StackPanel>
|
||||
<Button Content="Apply" HorizontalAlignment="Stretch" Margin="0, 25, 0, 0" Click="Button_Click"/>
|
||||
|
||||
</StackPanel>
|
||||
<StackPanel
|
||||
|
@ -473,7 +482,9 @@
|
|||
Style="{StaticResource CaptionTextBlockStyle}" />
|
||||
<Border Grid.Row="1"
|
||||
Grid.Column="0"
|
||||
Margin="0,0,6,0" HorizontalAlignment="Left"
|
||||
Margin="0,0,6,0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="5, 0, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
|
@ -489,6 +500,7 @@
|
|||
Grid.Column="1"
|
||||
Margin="6,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="5, 0, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
|
@ -553,6 +565,7 @@
|
|||
Grid.Column="0"
|
||||
Margin="0,0,6,0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="5, 0, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
|
@ -566,6 +579,7 @@
|
|||
Grid.Column="1"
|
||||
Margin="6,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="5, 0, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
|
@ -629,6 +643,7 @@
|
|||
Grid.Column="0"
|
||||
Margin="0,0,6,0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="5, 0, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
|
@ -642,6 +657,7 @@
|
|||
Grid.Column="1"
|
||||
Margin="6,0,0,0"
|
||||
HorizontalAlignment="Left"
|
||||
Padding="5, 0, 0, 0"
|
||||
VerticalAlignment="Top"
|
||||
BorderThickness="1"
|
||||
BorderBrush="{ThemeResource ButtonBackgroundThemeBrush}"
|
||||
|
|
|
@ -90,7 +90,6 @@ namespace FluentEditor.ControlPalette
|
|||
|
||||
private void ControlRoundSliderOverlay_ValueChanged(object sender, Windows.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e)
|
||||
{
|
||||
CornerRadius cornerRadius = (CornerRadius)App.Current.Resources["OverlayCornerRadius"];
|
||||
App.Current.Resources["OverlayCornerRadius"] = new CornerRadius(ControlRoundSliderOverlay.Value);
|
||||
}
|
||||
|
||||
|
@ -109,11 +108,6 @@ namespace FluentEditor.ControlPalette
|
|||
textBox.SelectAll();
|
||||
}
|
||||
|
||||
private void TextBox_LostFocus(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateCorners();
|
||||
}
|
||||
|
||||
private void UpdateCorners()
|
||||
{
|
||||
App.Current.Resources["ControlCornerRadius"] =
|
||||
|
@ -130,26 +124,27 @@ namespace FluentEditor.ControlPalette
|
|||
}
|
||||
}
|
||||
|
||||
private void ControlBorderThicknessSlider_ValueChanged(object sender, Windows.UI.Xaml.Controls.Primitives.RangeBaseValueChangedEventArgs e)
|
||||
{
|
||||
UpdateBorderThickness(new Thickness(ControlBorderThicknessSlider.Value));
|
||||
RefreshControls();
|
||||
}
|
||||
|
||||
private void UpdateBorderThickness(Thickness value)
|
||||
{
|
||||
App.Current.Resources["ComboBoxBorderThemeThickness"] = value;
|
||||
App.Current.Resources["DatePickerBorderThemeThickness"] = value;
|
||||
App.Current.Resources["TimePickerBorderThemeThickness"] = value;
|
||||
App.Current.Resources["TextControlBorderThemeThickness"] = value;
|
||||
App.Current.Resources["CheckBoxBorderThemeThickness"] = value;
|
||||
App.Current.Resources["ToggleSwitchOuterBorderStrokeThickness"] = value;
|
||||
App.Current.Resources["RadioButtonBorderThemeThickness"] = value;
|
||||
|
||||
App.Current.Resources["ToggleSwitchOuterBorderStrokeThickness"] = EqualizeThicknessValue(value);
|
||||
App.Current.Resources["CheckBoxBorderThemeThickness"] = EqualizeThicknessValue(value);
|
||||
App.Current.Resources["RadioButtonBorderThemeThickness"] = EqualizeThicknessValue(value);
|
||||
}
|
||||
|
||||
private void TextBoxOverlay_LostFocus(object sender, RoutedEventArgs e)
|
||||
private Thickness EqualizeThicknessValue(Thickness before)
|
||||
{
|
||||
UpdateOverlayCorners();
|
||||
Thickness after = new Thickness(1);
|
||||
double finalEqualValue = Math.Max(Math.Max(Math.Max(before.Left, before.Right), before.Top), before.Bottom);
|
||||
|
||||
if (finalEqualValue > 0)
|
||||
after = new Thickness(finalEqualValue);
|
||||
|
||||
return after;
|
||||
}
|
||||
|
||||
private void UpdateOverlayCorners()
|
||||
|
@ -167,12 +162,53 @@ namespace FluentEditor.ControlPalette
|
|||
}
|
||||
}
|
||||
|
||||
private void TextBoxBorder_LostFocus(object sender, RoutedEventArgs e)
|
||||
private void TextBoxBorder_KeyDown(object sender, Windows.UI.Xaml.Input.KeyRoutedEventArgs e)
|
||||
{
|
||||
if (e.Key == Windows.System.VirtualKey.Enter)
|
||||
{
|
||||
UpdateBorderThickness(new Thickness(Double.Parse(LeftBorderTB.Text), Double.Parse(TopBorderTB.Text),
|
||||
Double.Parse(RightBorderTB.Text), Double.Parse(BottomBorderTB.Text)));
|
||||
|
||||
RefreshControls();
|
||||
}
|
||||
}
|
||||
|
||||
private void Button_Click(object sender, RoutedEventArgs e)
|
||||
{
|
||||
UpdateBorderThickness(new Thickness(Double.Parse(LeftBorderTB.Text), Double.Parse(TopBorderTB.Text),
|
||||
Double.Parse(RightBorderTB.Text), Double.Parse(BottomBorderTB.Text)));
|
||||
UpdateCorners();
|
||||
UpdateOverlayCorners();
|
||||
|
||||
RefreshControls();
|
||||
}
|
||||
|
||||
private void ComboBox_SelectionChanged(object sender, SelectionChangedEventArgs e)
|
||||
{
|
||||
ComboBox comboBox = sender as ComboBox;
|
||||
|
||||
if (ControlBorderThicknessSlider == null)
|
||||
return;
|
||||
|
||||
if (comboBox.SelectedIndex == 1)
|
||||
{
|
||||
ControlBorderThicknessSlider.Value = 2;
|
||||
ControlRoundSlider.Value = 0;
|
||||
ControlRoundSliderOverlay.Value = 0;
|
||||
}
|
||||
else
|
||||
{
|
||||
ControlBorderThicknessSlider.Value = 1;
|
||||
ControlRoundSlider.Value = 2;
|
||||
ControlRoundSliderOverlay.Value = 4;
|
||||
|
||||
}
|
||||
|
||||
UpdateBorderThickness(new Thickness(Double.Parse(LeftBorderTB.Text), Double.Parse(TopBorderTB.Text),
|
||||
Double.Parse(RightBorderTB.Text), Double.Parse(BottomBorderTB.Text)));
|
||||
UpdateCorners();
|
||||
UpdateOverlayCorners();
|
||||
RefreshControls();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -10,6 +10,7 @@ using Windows.Data.Json;
|
|||
using Windows.Storage;
|
||||
using Windows.UI;
|
||||
using System.Linq;
|
||||
using Windows.UI.Xaml.Media;
|
||||
|
||||
namespace FluentEditor.ControlPalette.Model
|
||||
{
|
||||
|
@ -242,6 +243,7 @@ namespace FluentEditor.ControlPalette.Model
|
|||
|
||||
_lightRegion.ActiveColor = preset.LightRegionColor;
|
||||
_darkRegion.ActiveColor = preset.DarkRegionColor;
|
||||
|
||||
_lightBase.BaseColor.ActiveColor = preset.LightBaseColor;
|
||||
_darkBase.BaseColor.ActiveColor = preset.DarkBaseColor;
|
||||
_lightPrimary.BaseColor.ActiveColor = preset.LightPrimaryColor;
|
||||
|
|
|
@ -163,7 +163,7 @@
|
|||
<value>Unable to load</value>
|
||||
</data>
|
||||
<data name="ControlPalettePresetCombo.Header" xml:space="preserve">
|
||||
<value>Presets</value>
|
||||
<value>Color Presets</value>
|
||||
</data>
|
||||
<data name="ControlPalettePresetCombo.PlaceholderText" xml:space="preserve">
|
||||
<value>Custom</value>
|
||||
|
|
|
@ -9,9 +9,12 @@ namespace FluentEditorShared.ColorPalette
|
|||
{
|
||||
public class ColorPaletteEditor : Control
|
||||
{
|
||||
private double collapsedHeight = 56;
|
||||
private double expandedHeight = 465;
|
||||
public ColorPaletteEditor()
|
||||
{
|
||||
this.DefaultStyleKey = typeof(ColorPaletteEditor);
|
||||
this.Height = collapsedHeight;
|
||||
}
|
||||
|
||||
#region ColorPaletteProperty
|
||||
|
@ -63,8 +66,23 @@ namespace FluentEditorShared.ColorPalette
|
|||
|
||||
public bool IsExpanded
|
||||
{
|
||||
get { return (bool)GetValue(IsExpandedProperty); }
|
||||
set { SetValue(IsExpandedProperty, value); }
|
||||
get
|
||||
{
|
||||
return (bool)GetValue(IsExpandedProperty);
|
||||
}
|
||||
set
|
||||
{
|
||||
AdjustHeight(value);
|
||||
SetValue(IsExpandedProperty, value);
|
||||
}
|
||||
}
|
||||
|
||||
private void AdjustHeight(bool isExpanded)
|
||||
{
|
||||
if (isExpanded)
|
||||
this.Height = expandedHeight;
|
||||
else
|
||||
this.Height = collapsedHeight;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
|
|
@ -107,7 +107,7 @@
|
|||
Grid.Column="2"
|
||||
Margin="0,12,12,12"
|
||||
ColorChanged="ColorPicker_ColorChanged"
|
||||
Color="{x:Bind Path=ColorPaletteEntry.ActiveColor, Mode=OneWay}" />
|
||||
Color="{x:Bind Path=ColorPaletteEntry.ActiveColor, Mode=OneWay}"/>
|
||||
|
||||
<Button
|
||||
x:Name="RevertButton"
|
||||
|
|
|
@ -14,7 +14,11 @@ namespace FluentEditorShared.ColorPalette
|
|||
string Title { get; }
|
||||
string Description { get; }
|
||||
|
||||
Color ActiveColor { get; set; }
|
||||
Color ActiveColor
|
||||
{
|
||||
get;
|
||||
set;
|
||||
}
|
||||
string ActiveColorString { get; }
|
||||
FluentEditorShared.Utils.ColorStringFormat ActiveColorStringFormat { get; }
|
||||
|
||||
|
|
|
@ -14,11 +14,15 @@
|
|||
<SolidColorBrush x:Key="PaletteEditorDividerBrush" Color="#FF424242" />
|
||||
<SolidColorBrush x:Key="PaletteEntryEditorBorderBrush" Color="Transparent" />
|
||||
<Thickness x:Key="PaletteEntryEditorBorderThickness">0 0 0 0</Thickness>
|
||||
|
||||
<AcrylicBrush x:Key="SystemControlAcrylicWindowBrush" BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemChromeAltHighColor_Dark}" TintOpacity="0.8" FallbackColor="{ThemeResource SystemChromeMediumColor_Dark}" />
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="Light">
|
||||
<SolidColorBrush x:Key="PaletteEditorDividerBrush" Color="#FF424242" />
|
||||
<SolidColorBrush x:Key="PaletteEntryEditorBorderBrush" Color="Transparent" />
|
||||
<Thickness x:Key="PaletteEntryEditorBorderThickness">0 0 0 0</Thickness>
|
||||
|
||||
<AcrylicBrush x:Key="SystemControlAcrylicWindowBrush" BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemChromeAltHighColor}" TintOpacity="0.8" FallbackColor="{ThemeResource SystemChromeMediumColor}" />
|
||||
</ResourceDictionary>
|
||||
<ResourceDictionary x:Key="HighContrast">
|
||||
<SolidColorBrush x:Key="PaletteEditorDividerBrush" Color="#FF000000" />
|
||||
|
@ -30,16 +34,25 @@
|
|||
<local:ColorToStringConverter x:Key="ColorToStringConverter" />
|
||||
<local:NullableColorToStringConverter x:Key="NullableColorToStringConverter" />
|
||||
|
||||
<Color x:Key="SystemAccentColor">#ff0073CF</Color>
|
||||
<Color x:Key="SystemChromeAltHighColor">#FF32a852</Color>
|
||||
<Color x:Key="SystemChromeMediumColor">#FF32a852</Color>
|
||||
|
||||
<Color x:Key="SystemChromeAltHighColor_Dark">#FF2B2B2B</Color>
|
||||
<Color x:Key="SystemChromeMediumColor_Dark">#FF2B2B2B</Color>
|
||||
|
||||
<AcrylicBrush x:Key="SystemControlAccentAcrylicWindowAccentMediumHighBrush" BackgroundSource="HostBackdrop" TintColor="{ThemeResource SystemAccentColor}" TintOpacity="0.8" FallbackColor="{ThemeResource SystemAccentColor}" />
|
||||
|
||||
<CornerRadius x:Key="ControlCornerRadius">2</CornerRadius>
|
||||
<CornerRadius x:Key="OverlayCornerRadius">4</CornerRadius>
|
||||
|
||||
<Thickness x:Key="ComboBoxBorderThemeThickness">5</Thickness>
|
||||
<Thickness x:Key="DatePickerBorderThemeThickness">5</Thickness>
|
||||
<Thickness x:Key="TimePickerBorderThemeThickness">5</Thickness>
|
||||
<Thickness x:Key="TextControlBorderThemeThickness">5</Thickness>
|
||||
<Thickness x:Key="CheckBoxBorderThemeThickness">5</Thickness>
|
||||
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">5</Thickness>
|
||||
<Thickness x:Key="RadioButtonBorderThemeThickness">5</Thickness>
|
||||
<Thickness x:Key="ComboBoxBorderThemeThickness">1</Thickness>
|
||||
<Thickness x:Key="DatePickerBorderThemeThickness">1</Thickness>
|
||||
<Thickness x:Key="TimePickerBorderThemeThickness">1</Thickness>
|
||||
<Thickness x:Key="TextControlBorderThemeThickness">1</Thickness>
|
||||
<Thickness x:Key="CheckBoxBorderThemeThickness">1</Thickness>
|
||||
<Thickness x:Key="ToggleSwitchOuterBorderStrokeThickness">1</Thickness>
|
||||
<Thickness x:Key="RadioButtonBorderThemeThickness">1</Thickness>
|
||||
|
||||
<Style x:Key="HitboxButton" TargetType="Button">
|
||||
<Setter Property="Background" Value="Transparent" />
|
||||
|
|
Загрузка…
Ссылка в новой задаче