@ -1,6 +1,5 @@
using Avalonia.Controls ;
using Avalonia.Controls ;
using Avalonia.Controls.ApplicationLifetimes ;
using Avalonia.Controls.ApplicationLifetimes ;
using Avalonia.Controls.Notifications ;
using Avalonia.Dialogs ;
using Avalonia.Dialogs ;
using Avalonia.Platform ;
using Avalonia.Platform ;
using System ;
using System ;
@ -22,6 +21,9 @@ namespace ControlCatalog.ViewModels
private bool _ isSystemBarVisible ;
private bool _ isSystemBarVisible ;
private bool _d isplayEdgeToEdge ;
private bool _d isplayEdgeToEdge ;
private Thickness _ safeAreaPadding ;
private Thickness _ safeAreaPadding ;
private bool _ canResize ;
private bool _ canMinimize ;
private bool _ canMaximize ;
public MainWindowViewModel ( )
public MainWindowViewModel ( )
{
{
@ -49,7 +51,7 @@ namespace ControlCatalog.ViewModels
WindowState . FullScreen ,
WindowState . FullScreen ,
} ;
} ;
this . PropertyChanged + = ( s , e ) = >
PropertyChanged + = ( s , e ) = >
{
{
if ( e . PropertyName is nameof ( SystemTitleBarEnabled ) or nameof ( PreferSystemChromeEnabled ) )
if ( e . PropertyName is nameof ( SystemTitleBarEnabled ) or nameof ( PreferSystemChromeEnabled ) )
{
{
@ -67,70 +69,104 @@ namespace ControlCatalog.ViewModels
}
}
} ;
} ;
SystemTitleBarEnabled = true ;
SystemTitleBarEnabled = true ;
TitleBarHeight = - 1 ;
TitleBarHeight = - 1 ;
CanResize = true ;
CanMinimize = true ;
CanMaximize = true ;
}
}
public ExtendClientAreaChromeHints ChromeHints
public ExtendClientAreaChromeHints ChromeHints
{
{
get { return _ chromeHints ; }
get { return _ chromeHints ; }
set { this . RaiseAndSetIfChanged ( ref _ chromeHints , value ) ; }
set { RaiseAndSetIfChanged ( ref _ chromeHints , value ) ; }
}
}
public bool ExtendClientAreaEnabled
public bool ExtendClientAreaEnabled
{
{
get { return _ extendClientAreaEnabled ; }
get { return _ extendClientAreaEnabled ; }
set { this . RaiseAndSetIfChanged ( ref _ extendClientAreaEnabled , value ) ; }
set
{
if ( RaiseAndSetIfChanged ( ref _ extendClientAreaEnabled , value ) & & ! value )
{
SystemTitleBarEnabled = true ;
}
}
}
}
public bool SystemTitleBarEnabled
public bool SystemTitleBarEnabled
{
{
get { return _ systemTitleBarEnabled ; }
get { return _ systemTitleBarEnabled ; }
set { this . RaiseAndSetIfChanged ( ref _ systemTitleBarEnabled , value ) ; }
set
{
if ( RaiseAndSetIfChanged ( ref _ systemTitleBarEnabled , value ) & & ! value )
{
TitleBarHeight = - 1 ;
}
}
}
}
public bool PreferSystemChromeEnabled
public bool PreferSystemChromeEnabled
{
{
get { return _ preferSystemChromeEnabled ; }
get { return _ preferSystemChromeEnabled ; }
set { this . RaiseAndSetIfChanged ( ref _ preferSystemChromeEnabled , value ) ; }
set { RaiseAndSetIfChanged ( ref _ preferSystemChromeEnabled , value ) ; }
}
}
public double TitleBarHeight
public double TitleBarHeight
{
{
get { return _ titleBarHeight ; }
get { return _ titleBarHeight ; }
set { this . RaiseAndSetIfChanged ( ref _ titleBarHeight , value ) ; }
set { RaiseAndSetIfChanged ( ref _ titleBarHeight , value ) ; }
}
}
public WindowState WindowState
public WindowState WindowState
{
{
get { return _ windowState ; }
get { return _ windowState ; }
set { this . RaiseAndSetIfChanged ( ref _ windowState , value ) ; }
set { RaiseAndSetIfChanged ( ref _ windowState , value ) ; }
}
}
public WindowState [ ] WindowStates
public WindowState [ ] WindowStates
{
{
get { return _ windowStates ; }
get { return _ windowStates ; }
set { this . RaiseAndSetIfChanged ( ref _ windowStates , value ) ; }
set { RaiseAndSetIfChanged ( ref _ windowStates , value ) ; }
}
}
public bool IsSystemBarVisible
public bool IsSystemBarVisible
{
{
get { return _ isSystemBarVisible ; }
get { return _ isSystemBarVisible ; }
set { this . RaiseAndSetIfChanged ( ref _ isSystemBarVisible , value ) ; }
set { RaiseAndSetIfChanged ( ref _ isSystemBarVisible , value ) ; }
}
}
public bool DisplayEdgeToEdge
public bool DisplayEdgeToEdge
{
{
get { return _d isplayEdgeToEdge ; }
get { return _d isplayEdgeToEdge ; }
set { this . RaiseAndSetIfChanged ( ref _d isplayEdgeToEdge , value ) ; }
set { RaiseAndSetIfChanged ( ref _d isplayEdgeToEdge , value ) ; }
}
}
public Thickness SafeAreaPadding
public Thickness SafeAreaPadding
{
{
get { return _ safeAreaPadding ; }
get { return _ safeAreaPadding ; }
set { this . RaiseAndSetIfChanged ( ref _ safeAreaPadding , value ) ; }
set { RaiseAndSetIfChanged ( ref _ safeAreaPadding , value ) ; }
}
public bool CanResize
{
get { return _ canResize ; }
set { RaiseAndSetIfChanged ( ref _ canResize , value ) ; }
}
public bool CanMinimize
{
get { return _ canMinimize ; }
set { RaiseAndSetIfChanged ( ref _ canMinimize , value ) ; }
}
}
public bool CanMaximize
{
get { return _ canMaximize ; }
set { RaiseAndSetIfChanged ( ref _ canMaximize , value ) ; }
}
public MiniCommand AboutCommand { get ; }
public MiniCommand AboutCommand { get ; }
public MiniCommand ExitCommand { get ; }
public MiniCommand ExitCommand { get ; }
@ -144,7 +180,7 @@ namespace ControlCatalog.ViewModels
public DateTime ? ValidatedDateExample
public DateTime ? ValidatedDateExample
{
{
get = > _ validatedDateExample ;
get = > _ validatedDateExample ;
set = > this . RaiseAndSetIfChanged ( ref _ validatedDateExample , value ) ;
set = > RaiseAndSetIfChanged ( ref _ validatedDateExample , value ) ;
}
}
}
}
}
}