-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathMainWindow.xaml.cpp
51 lines (38 loc) · 1.42 KB
/
MainWindow.xaml.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
// Copyright (c) Microsoft Corporation and Contributors.
// Licensed under the MIT License.
#include "pch.h"
#include "MainWindow.xaml.h"
#if __has_include("MainWindow.g.cpp")
#include "MainWindow.g.cpp"
#endif
using namespace winrt;
using namespace Microsoft::UI::Xaml;
#include "App.xaml.h"//To access current window
#include <microsoft.ui.xaml.window.h>//For IWindowNative
#include "SystemBackdropHelper.hpp"
// To learn more about WinUI, the WinUI project structure,
// and more about our project templates, see: http://aka.ms/winui-project-info.
namespace winrt::WinUI3_TransparentBackground_CppWinRT::implementation
{
MainWindow::MainWindow()
{
InitializeComponent();
HWND hWnd;
this->try_as<IWindowNative>()->get_WindowHandle(&hWnd);
SystemBackdropHelper::SystemBackdropHelper::RemoveWin32Backdrop(hWnd);
}
int32_t MainWindow::MyProperty()
{
throw hresult_not_implemented();
}
void MainWindow::MyProperty(int32_t /* value */)
{
throw hresult_not_implemented();
}
}
void winrt::WinUI3_TransparentBackground_CppWinRT::implementation::MainWindow::SystemBackdropColorChanged(winrt::Microsoft::UI::Xaml::Controls::ColorPicker const& sender, winrt::Microsoft::UI::Xaml::Controls::ColorChangedEventArgs const& args)
{
SystemBackdropHelper::SystemBackdropHelper::SetSystemBackdrop(
App::Window(), true, SystemBackdropColor().Color()
);
}