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,118 +188,125 @@
|
|||||||
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" />
|
<RowDefinition />
|
||||||
<RowDefinition />
|
</Grid.RowDefinitions>
|
||||||
</Grid.RowDefinitions>
|
<TextBlock Margin="10,10,10,0" Text="NAVIGATION" />
|
||||||
<TextBlock Margin="10,10,10,0" Text="NAVIGATION" />
|
<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" />
|
||||||
<TreeViewItem Header="Child2" IsEnabled="False" />
|
<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">
|
||||||
<Grid>
|
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="True">
|
||||||
<Grid.ColumnDefinitions>
|
|
||||||
<ColumnDefinition />
|
|
||||||
<ColumnDefinition />
|
<Grid>
|
||||||
<ColumnDefinition />
|
|
||||||
</Grid.ColumnDefinitions>
|
|
||||||
<ui:SimpleStackPanel
|
|
||||||
Grid.Column="0"
|
|
||||||
Margin="5"
|
|
||||||
Orientation="Vertical"
|
|
||||||
Spacing="5">
|
|
||||||
<Button
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Command="{Binding OpenViewModelCommand}"
|
|
||||||
Content="Open" />
|
|
||||||
<Button
|
|
||||||
HorizontalAlignment="Stretch"
|
|
||||||
Command="{Binding SaveViewModelCommand}"
|
|
||||||
Content="Save" />
|
|
||||||
</ui:SimpleStackPanel>
|
|
||||||
</Grid>
|
|
||||||
</TabItem>
|
|
||||||
<TabItem Header="General" IsSelected="True">
|
|
||||||
<ui:SimpleStackPanel Margin="5" Spacing="10">
|
|
||||||
<controls:PropertyPresenter Label="Theme Mode" Value="{Binding ThemeMode}" />
|
|
||||||
<controls:PropertyPresenter
|
|
||||||
Command="{Binding ShowDialogCommand}"
|
|
||||||
Label="Hello"
|
|
||||||
Symbol="x³"
|
|
||||||
Value="{Binding WelcomeMessage}" />
|
|
||||||
<controls:PropertyPresenter
|
|
||||||
IsReadOnly="True"
|
|
||||||
Label="Hallo"
|
|
||||||
Symbol="x²"
|
|
||||||
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
<controls:PropertyPresenter
|
|
||||||
Label="Good bye"
|
|
||||||
Symbol="x²"
|
|
||||||
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
|
|
||||||
<Grid Margin="0,5">
|
|
||||||
<Grid.ColumnDefinitions>
|
<Grid.ColumnDefinitions>
|
||||||
<ColumnDefinition Width="Auto" />
|
<ColumnDefinition />
|
||||||
|
<ColumnDefinition />
|
||||||
<ColumnDefinition />
|
<ColumnDefinition />
|
||||||
</Grid.ColumnDefinitions>
|
</Grid.ColumnDefinitions>
|
||||||
<ToggleButton
|
<ui:SimpleStackPanel
|
||||||
x:Name="Switch"
|
|
||||||
Grid.Column="0"
|
Grid.Column="0"
|
||||||
Width="145"
|
Margin="5"
|
||||||
Margin="0,0,5,0">
|
Orientation="Vertical"
|
||||||
<ToggleButton.Style>
|
Spacing="5">
|
||||||
<Style BasedOn="{StaticResource {x:Type ToggleButton}}" TargetType="ToggleButton">
|
<Button
|
||||||
<Setter Property="Content" Value="Read/Write" />
|
HorizontalAlignment="Stretch"
|
||||||
<Style.Triggers>
|
Command="{Binding OpenViewModelCommand}"
|
||||||
<Trigger Property="IsChecked" Value="True">
|
Content="Open" />
|
||||||
<Setter Property="Content" Value="Read only" />
|
<Button
|
||||||
</Trigger>
|
HorizontalAlignment="Stretch"
|
||||||
</Style.Triggers>
|
Command="{Binding SaveViewModelCommand}"
|
||||||
</Style>
|
Content="Save" />
|
||||||
</ToggleButton.Style>
|
</ui:SimpleStackPanel>
|
||||||
</ToggleButton>
|
|
||||||
<TextBox
|
|
||||||
Grid.Column="1"
|
|
||||||
IsReadOnly="{Binding IsChecked, ElementName=Switch}"
|
|
||||||
Text="Eine einfache Textbox" />
|
|
||||||
</Grid>
|
</Grid>
|
||||||
<controls:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" />
|
</ScrollViewer>
|
||||||
<controls:PropertyPresenter Label="Hello">
|
</TabItem>
|
||||||
<Slider
|
<TabItem Header="General" IsSelected="True">
|
||||||
AutoToolTipPlacement="TopLeft"
|
<ScrollViewer ui:ScrollViewerHelper.AutoHideScrollBars="True">
|
||||||
Interval="1"
|
|
||||||
IsSnapToTickEnabled="True"
|
<ui:SimpleStackPanel Margin="5" Spacing="10">
|
||||||
Maximum="150"
|
<controls:PropertyPresenter Label="Theme Mode" Value="{Binding ThemeMode}" />
|
||||||
Minimum="50"
|
<controls:PropertyPresenter Label="Accent color" Value="{Binding AccentColor}" />
|
||||||
TickFrequency="10"
|
<controls:PropertyPresenter
|
||||||
TickPlacement="BottomRight"
|
Command="{Binding ShowDialogCommand}"
|
||||||
Value="{Binding SliderTest}" />
|
Label="Hello"
|
||||||
</controls:PropertyPresenter>
|
Symbol="x³"
|
||||||
<ui:ProgressRing
|
Value="{Binding WelcomeMessage}" />
|
||||||
Width="{Binding SliderTest}"
|
<controls:PropertyPresenter
|
||||||
Height="{Binding SliderTest}"
|
IsReadOnly="True"
|
||||||
IsActive="{Binding BooleanValue}"
|
Label="Hallo"
|
||||||
Visibility="{Binding VisibilityEnumTest}" />
|
Symbol="x²"
|
||||||
<controls:PropertyPresenter Label="Visi" Value="{Binding VisibilityEnumTest}" />
|
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
</ui:SimpleStackPanel>
|
<controls:PropertyPresenter
|
||||||
|
Label="Good bye"
|
||||||
|
Symbol="x²"
|
||||||
|
Value="{Binding ValidationTest, UpdateSourceTrigger=PropertyChanged}" />
|
||||||
|
<Grid Margin="0,5">
|
||||||
|
<Grid.ColumnDefinitions>
|
||||||
|
<ColumnDefinition Width="Auto" />
|
||||||
|
<ColumnDefinition />
|
||||||
|
</Grid.ColumnDefinitions>
|
||||||
|
<ToggleButton
|
||||||
|
x:Name="TextBoxSwitch"
|
||||||
|
Grid.Column="0"
|
||||||
|
Width="145"
|
||||||
|
Margin="0,0,5,0">
|
||||||
|
<ToggleButton.Style>
|
||||||
|
<Style BasedOn="{StaticResource {x:Type ToggleButton}}" TargetType="ToggleButton">
|
||||||
|
<Setter Property="Content" Value="Read/Write" />
|
||||||
|
<Style.Triggers>
|
||||||
|
<Trigger Property="IsChecked" Value="True">
|
||||||
|
<Setter Property="Content" Value="Read only" />
|
||||||
|
</Trigger>
|
||||||
|
</Style.Triggers>
|
||||||
|
</Style>
|
||||||
|
</ToggleButton.Style>
|
||||||
|
</ToggleButton>
|
||||||
|
<TextBox
|
||||||
|
Grid.Column="1"
|
||||||
|
IsReadOnly="{Binding IsChecked, ElementName=TextBoxSwitch}"
|
||||||
|
Text="Eine einfache Textbox" />
|
||||||
|
</Grid>
|
||||||
|
<controls:PropertyPresenter Label="Hello" Value="{Binding BooleanValue}" />
|
||||||
|
<controls:PropertyPresenter Label="Hello">
|
||||||
|
<Slider
|
||||||
|
AutoToolTipPlacement="TopLeft"
|
||||||
|
Interval="1"
|
||||||
|
IsSnapToTickEnabled="True"
|
||||||
|
Maximum="150"
|
||||||
|
Minimum="50"
|
||||||
|
TickFrequency="10"
|
||||||
|
TickPlacement="BottomRight"
|
||||||
|
Value="{Binding SliderTest}" />
|
||||||
|
</controls:PropertyPresenter>
|
||||||
|
<ui:ProgressRing
|
||||||
|
Width="{Binding SliderTest}"
|
||||||
|
Height="{Binding SliderTest}"
|
||||||
|
IsActive="{Binding BooleanValue}"
|
||||||
|
Visibility="{Binding VisibilityEnumTest}" />
|
||||||
|
<controls:PropertyPresenter Label="Visi" Value="{Binding VisibilityEnumTest}" />
|
||||||
|
</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