Skip to content

Commit

Permalink
Merge pull request #4 from Clrs17/Win32WindowCreation
Browse files Browse the repository at this point in the history
Win32 window creation
  • Loading branch information
wherewhere authored Nov 4, 2023
2 parents 908d66c + 5780957 commit 791322b
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 6 deletions.
4 changes: 4 additions & 0 deletions CoreAppUWP/CoreAppUWP.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -72,4 +72,8 @@
<ItemGroup>
<ProjectReference Include="..\CoreAppUWP.WinRT\CoreAppUWP.WinRT.vcxproj" />
</ItemGroup>

<ItemGroup>
<Content Include="favicon.ico" />
</ItemGroup>
</Project>
25 changes: 19 additions & 6 deletions CoreAppUWP/Pages/SettingsPages/SettingsPage.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,14 +87,27 @@
Content="Exit" />
</StackPanel>
</controls:Setting>
<controls:Setting
ActionIcon="&#xE8A7;"
Click="Button_Click"
<controls:SettingExpander
Description="Create a new window."
Header="Multiple Window"
Icon="&#xE78B;"
IsClickEnabled="True"
Tag="NewWindow" />
Icon="&#xE78B;">
<controls:Setting
ActionIcon="&#xE8A7;"
Click="Button_Click"
Description="Create a new CoreWindow."
Header="CoreWindow"
IsClickEnabled="True"
Style="{StaticResource ClickableSettingExpanderItemStyle}"
Tag="NewWindow" />
<controls:Setting
ActionIcon="&#xE8A7;"
Click="Button_Click"
Description="Create a new AppWindow."
Header="Desktop Window"
IsClickEnabled="True"
Style="{StaticResource ClickableSettingExpanderItemStyle}"
Tag="NewAppWindow" />
</controls:SettingExpander>
<controls:Setting
x:Name="SettingsFlyoutSettings"
x:Load="{x:Bind common:SettingsPaneRegister.IsSettingsPaneSupported}"
Expand Down
23 changes: 23 additions & 0 deletions CoreAppUWP/Pages/SettingsPages/SettingsPage.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,20 @@
using CoreAppUWP.Common;
using CoreAppUWP.Helpers;
using CoreAppUWP.ViewModels.SettingsPages;
using Microsoft.UI;
using Microsoft.UI.Windowing;
using Microsoft.UI.Xaml;
using Microsoft.UI.Xaml.Controls;
using Microsoft.UI.Xaml.Media.Animation;
using Microsoft.UI.Xaml.Navigation;
using System;
using System.Threading.Tasks;
using Windows.ApplicationModel;
using Windows.ApplicationModel.Core;
using Windows.ApplicationModel.Search;
using Windows.Storage;
using Windows.System;
using Windows.UI;
using Windows.UI.ApplicationSettings;
using Windows.UI.ViewManagement;

Expand Down Expand Up @@ -91,6 +95,25 @@ private async void Button_Click(object sender, RoutedEventArgs e)
BackdropHelper.SetBackdrop(window, SettingsHelper.Get<BackdropType>(SettingsHelper.SelectedBackdrop));
});
break;
case "NewAppWindow":
AppWindow window = AppWindow.Create();
window.Closing += (sender, args) => sender.Destroy();
if (AppWindowTitleBar.IsCustomizationSupported())
{
AppWindowTitleBar TitleBar = window.TitleBar;

Color ForegroundColor = Colors.Black;
Color BackgroundColor = Colors.White;

TitleBar.ExtendsContentIntoTitleBar = true;
TitleBar.ForegroundColor = TitleBar.ButtonForegroundColor = ForegroundColor;
TitleBar.BackgroundColor = TitleBar.InactiveBackgroundColor = BackgroundColor;
TitleBar.ButtonBackgroundColor = TitleBar.ButtonInactiveBackgroundColor = Colors.Transparent;
}
window.Title = Package.Current.DisplayName;
window.SetIcon("favicon.ico");
window.Show();
break;
case "SearchFlyout" when SettingsPaneRegister.IsSearchPaneSupported:
SearchPane.GetForCurrentView().Show();
break;
Expand Down

0 comments on commit 791322b

Please sign in to comment.