Prepare XAML for ancient .NET support

This commit is contained in:
Matt Nadareski
2023-11-15 12:10:54 -05:00
parent fe9302a553
commit f8d81972bf
11 changed files with 57 additions and 22 deletions

View File

@@ -10,6 +10,7 @@
- Support ancient .NET in UI
- Fix TLS for older .NET
- Perform more ancient .NET support work
- Prepare XAML for ancient .NET support
### 3.0.0 (2023-11-14)

View File

@@ -9,10 +9,6 @@
Title="" MinHeight="155" MaxWidth="470" MinWidth="154"
BorderBrush="DarkGray" BorderThickness="2">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
</WindowChrome.WindowChrome>
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="*" />

View File

@@ -88,6 +88,15 @@ namespace WPFCustomMessageBox
internal CustomMessageBoxWindow(Window? owner, string? message, string? caption = null, MessageBoxButton? button = null, MessageBoxImage? image = null, bool removeTitleBarIcon = true)
{
#if NET452_OR_GREATER
var chrome = new System.Windows.Shell.WindowChrome
{
CaptionHeight = 0,
ResizeBorderThickness = new Thickness(0),
};
System.Windows.Shell.WindowChrome.SetWindowChrome(this, chrome);
#endif
InitializeComponent();
_removeTitleBarIcon = removeTitleBarIcon;

View File

@@ -15,10 +15,7 @@
<Window.Resources>
<core:ElementConverter x:Key="ElementConverter" />
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
</WindowChrome.WindowChrome>
<Grid>
<StackPanel Orientation="Vertical" Width="500" MaxHeight="650">
<Grid Margin="0,10,0,0">

View File

@@ -22,6 +22,15 @@ namespace MPF.UI.Core.Windows
/// </summary>
public DiscInformationWindow(Options options, SubmissionInfo? submissionInfo)
{
#if NET452_OR_GREATER
var chrome = new System.Windows.Shell.WindowChrome
{
CaptionHeight = 0,
ResizeBorderThickness = new Thickness(0),
};
System.Windows.Shell.WindowChrome.SetWindowChrome(this, chrome);
#endif
InitializeComponent();
DataContext = new DiscInformationViewModel(options, submissionInfo);
DiscInformationViewModel.Load();
@@ -341,7 +350,7 @@ namespace MPF.UI.Core.Windows
}
}
#endregion
#endregion
#region Event Handlers

View File

@@ -18,9 +18,6 @@
<Window.Resources>
<core:ElementConverter x:Key="ElementConverter" />
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
</WindowChrome.WindowChrome>
<Grid>
<StackPanel Orientation="Vertical">

View File

@@ -20,7 +20,19 @@ namespace MPF.UI.Core.Windows
/// <summary>
/// Constructor
/// </summary>
public MainWindow() => InitializeComponent();
public MainWindow()
{
#if NET452_OR_GREATER
var chrome = new System.Windows.Shell.WindowChrome
{
CaptionHeight = 0,
ResizeBorderThickness = new Thickness(0),
};
System.Windows.Shell.WindowChrome.SetWindowChrome(this, chrome);
#endif
InitializeComponent();
}
/// <summary>
/// Handler for MainWindow OnContentRendered event

View File

@@ -13,9 +13,6 @@
<Window.Resources>
<core:ElementConverter x:Key="ElementConverter" />
</Window.Resources>
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
</WindowChrome.WindowChrome>
<Grid>
<StackPanel Orientation="Vertical">

View File

@@ -24,6 +24,15 @@ namespace MPF.UI.Core.Windows
/// </summary>
public OptionsWindow(Options options)
{
#if NET452_OR_GREATER
var chrome = new System.Windows.Shell.WindowChrome
{
CaptionHeight = 0,
ResizeBorderThickness = new Thickness(0),
};
System.Windows.Shell.WindowChrome.SetWindowChrome(this, chrome);
#endif
InitializeComponent();
DataContext = new OptionsViewModel(options);
@@ -159,7 +168,7 @@ namespace MPF.UI.Core.Windows
CustomMessageBox.Show(this, message, "Error", MessageBoxButton.OK, MessageBoxImage.Error);
}
#endregion
#endregion
#region Event Handlers

View File

@@ -10,10 +10,6 @@
WindowStartupLocation="CenterOwner" ResizeMode="CanMinimize" SizeToContent="Height"
BorderBrush="DarkGray" BorderThickness="2">
<WindowChrome.WindowChrome>
<WindowChrome CaptionHeight="0" ResizeBorderThickness="0" />
</WindowChrome.WindowChrome>
<Grid>
<StackPanel Orientation="Vertical">
<Grid Margin="0,10,0,0">

View File

@@ -5,6 +5,18 @@
/// </summary>
public partial class RingCodeGuideWindow : WindowBase
{
public RingCodeGuideWindow() => InitializeComponent();
public RingCodeGuideWindow()
{
#if NET452_OR_GREATER
var chrome = new System.Windows.Shell.WindowChrome
{
CaptionHeight = 0,
ResizeBorderThickness = new System.Windows.Thickness(0),
};
System.Windows.Shell.WindowChrome.SetWindowChrome(this, chrome);
#endif
InitializeComponent();
}
}
}