mirror of
https://github.com/holgerb83/ModernWpfPlayground.git
synced 2025-04-19 23:03:49 +02:00
binding window height and width and saving properties to file.
This commit is contained in:
parent
a5d05e05a3
commit
c44931c11e
@ -1,5 +1,4 @@
|
|||||||
|
<Window
|
||||||
<Window
|
|
||||||
x:Class="ModernWpfPlayground.MainWindow"
|
x:Class="ModernWpfPlayground.MainWindow"
|
||||||
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
|
||||||
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
|
||||||
@ -11,8 +10,8 @@
|
|||||||
xmlns:ui="http://schemas.modernwpf.com/2019"
|
xmlns:ui="http://schemas.modernwpf.com/2019"
|
||||||
x:Name="Window"
|
x:Name="Window"
|
||||||
Title="{Binding Title}"
|
Title="{Binding Title}"
|
||||||
Width="1200"
|
Width="{Binding WindowWidth, Mode=TwoWay}"
|
||||||
Height="600"
|
Height="{Binding WindowHeight, Mode=TwoWay}"
|
||||||
d:DataContext="{d:DesignInstance local:MainWindowViewModel}"
|
d:DataContext="{d:DesignInstance local:MainWindowViewModel}"
|
||||||
prism:ViewModelLocator.AutoWireViewModel="True"
|
prism:ViewModelLocator.AutoWireViewModel="True"
|
||||||
ui:ThemeManager.IsThemeAware="True"
|
ui:ThemeManager.IsThemeAware="True"
|
||||||
|
@ -93,6 +93,18 @@ namespace ModernWpfPlayground
|
|||||||
set => SetProperty(value, SetTheme);
|
set => SetProperty(value, SetTheme);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public int WindowWidth
|
||||||
|
{
|
||||||
|
get => GetProperty(1200);
|
||||||
|
set => SetProperty(value);
|
||||||
|
}
|
||||||
|
|
||||||
|
public int WindowHeight
|
||||||
|
{
|
||||||
|
get => GetProperty(600);
|
||||||
|
set => SetProperty(value);
|
||||||
|
}
|
||||||
|
|
||||||
private static void SetTheme(ThemeMode themeMode)
|
private static void SetTheme(ThemeMode themeMode)
|
||||||
{
|
{
|
||||||
ThemeManager.Current.ApplicationTheme = themeMode switch
|
ThemeManager.Current.ApplicationTheme = themeMode switch
|
||||||
|
Loading…
x
Reference in New Issue
Block a user