mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 23:03:49 +02:00
Added Accent color settings
This commit is contained in:
parent
22b5a433e9
commit
94f5eced01
10
App/AccentColor.cs
Normal file
10
App/AccentColor.cs
Normal file
@ -0,0 +1,10 @@
|
|||||||
|
namespace ModernWpfPlayground
|
||||||
|
{
|
||||||
|
public enum AccentColor
|
||||||
|
{
|
||||||
|
Green,
|
||||||
|
Yellow,
|
||||||
|
Blue,
|
||||||
|
Purple
|
||||||
|
}
|
||||||
|
}
|
@ -1,4 +1,6 @@
|
|||||||
using System.Windows;
|
using System.Windows;
|
||||||
|
using System.Windows.Media;
|
||||||
|
using ModernWpf;
|
||||||
using Prism.Ioc;
|
using Prism.Ioc;
|
||||||
|
|
||||||
namespace ModernWpfPlayground
|
namespace ModernWpfPlayground
|
||||||
@ -8,6 +10,13 @@ namespace ModernWpfPlayground
|
|||||||
/// </summary>
|
/// </summary>
|
||||||
public partial class App
|
public partial class App
|
||||||
{
|
{
|
||||||
|
/// <inheritdoc />
|
||||||
|
protected override void OnStartup(StartupEventArgs e)
|
||||||
|
{
|
||||||
|
ThemeManager.Current.AccentColor = Color.FromArgb(255, 0, 86, 76);
|
||||||
|
base.OnStartup(e);
|
||||||
|
}
|
||||||
|
|
||||||
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
protected override void RegisterTypes(IContainerRegistry containerRegistry)
|
||||||
{
|
{
|
||||||
containerRegistry.Register<MainWindow>();
|
containerRegistry.Register<MainWindow>();
|
||||||
|
@ -120,7 +120,7 @@
|
|||||||
<!-- Footer -->
|
<!-- Footer -->
|
||||||
<Grid
|
<Grid
|
||||||
Height="24"
|
Height="24"
|
||||||
Background="#00564C"
|
Background="{DynamicResource SystemControlBackgroundAccentBrush}"
|
||||||
DockPanel.Dock="Bottom">
|
DockPanel.Dock="Bottom">
|
||||||
<Grid.Resources>
|
<Grid.Resources>
|
||||||
<Style TargetType="TextBlock">
|
<Style TargetType="TextBlock">
|
||||||
@ -143,12 +143,12 @@
|
|||||||
HorizontalAlignment="Right"
|
HorizontalAlignment="Right"
|
||||||
Text="BlaBlaBla" />
|
Text="BlaBlaBla" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<!-- Content -->
|
|
||||||
<Grid Row="1">
|
<Grid Row="1">
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="40" />
|
<ColumnDefinition Width="40" />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
|
<!-- Workspace -->
|
||||||
<Border
|
<Border
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Panel.ZIndex="1"
|
Panel.ZIndex="1"
|
||||||
@ -188,15 +188,15 @@
|
|||||||
Text="Dummy inactive" />
|
Text="Dummy inactive" />
|
||||||
</ui:SimpleStackPanel>
|
</ui:SimpleStackPanel>
|
||||||
</Border>
|
</Border>
|
||||||
|
<!-- Navigation -->
|
||||||
<ui:SplitView
|
<ui:SplitView
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
BorderThickness="0"
|
BorderThickness="0"
|
||||||
DisplayMode="Inline"
|
DisplayMode="Inline"
|
||||||
IsPaneOpen="{Binding IsOn, ElementName=SplitViewSwitch}"
|
IsPaneOpen="{Binding IsOn, ElementName=SplitViewSwitch}"
|
||||||
OpenPaneLength="250"
|
OpenPaneLength="200"
|
||||||
PanePlacement="Left">
|
PanePlacement="Left">
|
||||||
<ui:SplitView.Pane>
|
<ui:SplitView.Pane>
|
||||||
<ScrollViewer>
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.RowDefinitions>
|
<Grid.RowDefinitions>
|
||||||
<RowDefinition Height="Auto" />
|
<RowDefinition Height="Auto" />
|
||||||
@ -206,16 +206,18 @@
|
|||||||
<TreeView Grid.Row="1">
|
<TreeView Grid.Row="1">
|
||||||
<TreeViewItem Header="Root" IsExpanded="True">
|
<TreeViewItem Header="Root" IsExpanded="True">
|
||||||
<TreeViewItem Header="Child1" />
|
<TreeViewItem Header="Child1" />
|
||||||
<TreeViewItem Header="Child2" IsEnabled="False" />
|
<TreeViewItem Header="Child2" />
|
||||||
<TreeViewItem Header="Child3" />
|
<TreeViewItem Header="Child3" />
|
||||||
</TreeViewItem>
|
</TreeViewItem>
|
||||||
</TreeView>
|
</TreeView>
|
||||||
</Grid>
|
</Grid>
|
||||||
</ScrollViewer>
|
|
||||||
|
|
||||||
</ui:SplitView.Pane>
|
</ui:SplitView.Pane>
|
||||||
|
<!-- Content -->
|
||||||
<TabControl>
|
<TabControl>
|
||||||
<TabItem Header="Bolt">
|
<TabItem Header="Bolt">
|
||||||
|
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="True">
|
||||||
|
|
||||||
|
|
||||||
<Grid>
|
<Grid>
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
@ -237,10 +239,14 @@
|
|||||||
Content="Save" />
|
Content="Save" />
|
||||||
</ui:SimpleStackPanel>
|
</ui:SimpleStackPanel>
|
||||||
</Grid>
|
</Grid>
|
||||||
|
</ScrollViewer>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
<TabItem Header="General" IsSelected="True">
|
<TabItem Header="General" IsSelected="True">
|
||||||
|
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="True">
|
||||||
|
|
||||||
<ui:SimpleStackPanel Margin="5" Spacing="10">
|
<ui:SimpleStackPanel Margin="5" Spacing="10">
|
||||||
<controls:PropertyPresenter Label="Theme Mode" Value="{Binding ThemeMode}" />
|
<controls:PropertyPresenter Label="Theme Mode" Value="{Binding ThemeMode}" />
|
||||||
|
<controls:PropertyPresenter Label="Accent color" Value="{Binding AccentColor}" />
|
||||||
<controls:PropertyPresenter
|
<controls:PropertyPresenter
|
||||||
Command="{Binding ShowDialogCommand}"
|
Command="{Binding ShowDialogCommand}"
|
||||||
Label="Hello"
|
Label="Hello"
|
||||||
@ -261,7 +267,7 @@
|
|||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ToggleButton
|
<ToggleButton
|
||||||
x:Name="Switch"
|
x:Name="TextBoxSwitch"
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Width="145"
|
Width="145"
|
||||||
Margin="0,0,5,0">
|
Margin="0,0,5,0">
|
||||||
@ -278,7 +284,7 @@
|
|||||||
</ToggleButton>
|
</ToggleButton>
|
||||||
<TextBox
|
<TextBox
|
||||||
Grid.Column="1"
|
Grid.Column="1"
|
||||||
IsReadOnly="{Binding IsChecked, ElementName=Switch}"
|
IsReadOnly="{Binding IsChecked, ElementName=TextBoxSwitch}"
|
||||||
Text="Eine einfache Textbox" />
|
Text="Eine einfache Textbox" />
|
||||||
</Grid>
|
</Grid>
|
||||||
<controls:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" />
|
<controls:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" />
|
||||||
@ -300,6 +306,7 @@
|
|||||||
Visibility="{Binding VisibilityEnumTest}" />
|
Visibility="{Binding VisibilityEnumTest}" />
|
||||||
<controls:PropertyPresenter Label="Visi" Value="{Binding VisibilityEnumTest}" />
|
<controls:PropertyPresenter Label="Visi" Value="{Binding VisibilityEnumTest}" />
|
||||||
</ui:SimpleStackPanel>
|
</ui:SimpleStackPanel>
|
||||||
|
</ScrollViewer>
|
||||||
</TabItem>
|
</TabItem>
|
||||||
</TabControl>
|
</TabControl>
|
||||||
</ui:SplitView>
|
</ui:SplitView>
|
||||||
|
@ -1,8 +1,10 @@
|
|||||||
using System.Collections.Generic;
|
using System;
|
||||||
|
using System.Collections.Generic;
|
||||||
using System.IO;
|
using System.IO;
|
||||||
using System.Threading.Tasks;
|
using System.Threading.Tasks;
|
||||||
using System.Windows;
|
using System.Windows;
|
||||||
using System.Windows.Input;
|
using System.Windows.Input;
|
||||||
|
using System.Windows.Media;
|
||||||
using Microsoft.Win32;
|
using Microsoft.Win32;
|
||||||
using ModernWpf;
|
using ModernWpf;
|
||||||
using ModernWpfPlayground.MvvmStuff;
|
using ModernWpfPlayground.MvvmStuff;
|
||||||
@ -94,6 +96,24 @@ namespace ModernWpfPlayground
|
|||||||
set => SetProperty(value, SetTheme);
|
set => SetProperty(value, SetTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public AccentColor AccentColor
|
||||||
|
{
|
||||||
|
get => GetProperty(AccentColor.Green);
|
||||||
|
set => SetProperty(value, SetAccentColor);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static void SetAccentColor(AccentColor accentColor)
|
||||||
|
{
|
||||||
|
ThemeManager.Current.AccentColor = accentColor switch
|
||||||
|
{
|
||||||
|
AccentColor.Green => Color.FromArgb(255, 0, 86, 76),
|
||||||
|
AccentColor.Yellow => Color.FromArgb(255, 164, 144, 0),
|
||||||
|
AccentColor.Blue => Color.FromArgb(255, 0, 120, 215),
|
||||||
|
AccentColor.Purple => Color.FromArgb(255, 104, 33, 122),
|
||||||
|
_ => throw new ArgumentOutOfRangeException(nameof(accentColor), accentColor, null)
|
||||||
|
};
|
||||||
|
}
|
||||||
|
|
||||||
public int WindowWidth
|
public int WindowWidth
|
||||||
{
|
{
|
||||||
get => GetProperty(1200);
|
get => GetProperty(1200);
|
||||||
|
@ -92,7 +92,7 @@
|
|||||||
DisplayMemberPath="Key"
|
DisplayMemberPath="Key"
|
||||||
ItemsSource="{Binding Value, ElementName=LayoutRoot, Converter={StaticResource EnumToKeyValuePairConverter}}"
|
ItemsSource="{Binding Value, ElementName=LayoutRoot, Converter={StaticResource EnumToKeyValuePairConverter}}"
|
||||||
SelectedValue="{Binding Value, ElementName=LayoutRoot}"
|
SelectedValue="{Binding Value, ElementName=LayoutRoot}"
|
||||||
SelectedValuePath="Value"
|
SelectedValuePath="Value" HorizontalAlignment="Stretch"
|
||||||
Validation.ErrorTemplate="{DynamicResource ValidationErrorTemplate}"
|
Validation.ErrorTemplate="{DynamicResource ValidationErrorTemplate}"
|
||||||
Validation.ValidationAdornerSiteFor="{Binding ElementName=LayoutRoot}">
|
Validation.ValidationAdornerSiteFor="{Binding ElementName=LayoutRoot}">
|
||||||
<ComboBox.Style>
|
<ComboBox.Style>
|
||||||
|
Loading…
x
Reference in New Issue
Block a user