├── .editorconfig
├── .github
├── FUNDING.yml
└── workflows
│ └── BuildBinaries.yml
├── .gitignore
├── .gitmodules
├── BuildAllTargets.cmd
├── BuildAllTargets.proj
├── Directory.Build.props
├── License.md
├── Mile.Xaml.Samples.sln
├── MileXamlBlankApp
├── App.cpp
├── App.h
├── App.idl
├── App.xaml
├── MainPage.cpp
├── MainPage.h
├── MainPage.idl
├── MainPage.xaml
├── MileXamlBlankApp.manifest
├── MileXamlBlankApp.vcxproj
├── PropertySheet.props
├── WinMain.cpp
├── pch.cpp
└── pch.h
├── MileXamlBlankAppNetCore
├── App.manifest
├── App.xaml
├── App.xaml.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── MainPage.xaml
├── MainPage.xaml.cs
├── MileXamlBlankAppNetCore.csproj
├── Program.cs
└── Properties
│ ├── PublishProfiles
│ ├── win-arm64.pubxml
│ └── win-x64.pubxml
│ └── launchSettings.json
├── MileXamlBlankAppNetCoreNativeBackend
├── App.manifest
├── App.xaml
├── App.xaml.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── MileXamlBlankAppNetCoreNativeBackend.csproj
├── NativeWrapper.cs
├── Program.cs
└── Properties
│ ├── PublishProfiles
│ ├── win-arm64.pubxml
│ └── win-x64.pubxml
│ └── launchSettings.json
├── MileXamlBlankAppNetFramework
├── App.manifest
├── App.xaml
├── App.xaml.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── MainPage.xaml
├── MainPage.xaml.cs
├── MileXamlBlankAppNetFramework.csproj
└── Program.cs
├── MileXamlBlankAppNetFrameworkNativeBackend
├── App.manifest
├── App.xaml
├── App.xaml.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── MileXamlBlankAppNetFrameworkNativeBackend.csproj
├── NativeWrapper.cs
└── Program.cs
├── MileXamlBlankAppNetFrameworkPackage
├── Images
│ ├── LockScreenLogo.scale-200.png
│ ├── SplashScreen.scale-200.png
│ ├── Square150x150Logo.scale-200.png
│ ├── Square44x44Logo.scale-200.png
│ ├── Square44x44Logo.targetsize-24_altform-unplated.png
│ ├── StoreLogo.png
│ └── Wide310x150Logo.scale-200.png
├── MileXamlBlankAppNetFrameworkPackage.wapproj
└── Package.appxmanifest
├── MileXamlControlsDemo
├── App.cpp
├── App.h
├── App.idl
├── App.xaml
├── MainPage.cpp
├── MainPage.h
├── MainPage.idl
├── MainPage.xaml
├── MileXamlControlsDemo.manifest
├── MileXamlControlsDemo.vcxproj
├── PropertySheet.props
├── TreeViewItemModel.cpp
├── TreeViewItemModel.h
├── TreeViewItemModel.idl
├── WinMain.cpp
├── pch.cpp
└── pch.h
├── MileXamlControlsDemoNetCore
├── App.manifest
├── App.xaml
├── App.xaml.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Helpers
│ └── BackdropHelper.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── MileXamlControlsDemoNetCore.csproj
├── Program.cs
├── Properties
│ ├── PublishProfiles
│ │ ├── win-arm64.pubxml
│ │ └── win-x64.pubxml
│ └── launchSettings.json
├── Resources
│ └── NoiseAsset_256x256_PNG.png
├── TreeViewItemModel.cs
├── UI
│ └── Backdrop
│ │ ├── BlendEffect.cs
│ │ ├── BlendEffectMode.cs
│ │ ├── BorderEffect.cs
│ │ ├── CanvasComposite.cs
│ │ ├── CanvasEdgeBehavior.cs
│ │ ├── ColorConversion.cs
│ │ ├── ColorSourceEffect.cs
│ │ ├── CompositeEffect.cs
│ │ ├── CrossFadeEffect.cs
│ │ ├── DesktopAcrylicBackdrop.cs
│ │ ├── DesktopAcrylicKind.cs
│ │ ├── EffectBorderMode.cs
│ │ ├── EffectOptimization.cs
│ │ ├── GaussianBlurEffect.cs
│ │ ├── MicaBackdrop.cs
│ │ ├── MicaKind.cs
│ │ ├── OpacityEffect.cs
│ │ └── SystemBackdrop.cs
└── WindowsAPI
│ ├── ComTypes
│ ├── D2D1_BUFFER_PRECISION.cs
│ ├── GRAPHICS_EFFECT_PROPERTY_MAPPING.cs
│ ├── ICompositorDesktopInterop.cs
│ ├── IGraphicsEffectD2D1Interop.cs
│ └── IPropertyValueStatics.cs
│ └── PInvoke
│ ├── Combase
│ └── CombaseLibrary.cs
│ ├── Comctl32
│ ├── Comctl32Library.cs
│ └── SUBCLASSPROC.cs
│ ├── Kernel32
│ ├── Kernel32Library.cs
│ └── SYSTEM_POWER_STATUS.cs
│ └── User32
│ ├── POWERBROADCAST_SETTING.cs
│ ├── User32Library.cs
│ └── WindowMessage.cs
├── MileXamlControlsDemoNetFramework
├── App.manifest
├── App.xaml
├── App.xaml.cs
├── Form1.Designer.cs
├── Form1.cs
├── Form1.resx
├── Helpers
│ └── BackdropHelper.cs
├── MainPage.xaml
├── MainPage.xaml.cs
├── MileXamlControlsDemoNetFramework.csproj
├── Program.cs
├── Resources
│ └── NoiseAsset_256x256_PNG.png
├── TreeViewItemModel.cs
├── UI
│ └── Backdrop
│ │ ├── BlendEffect.cs
│ │ ├── BlendEffectMode.cs
│ │ ├── BorderEffect.cs
│ │ ├── CanvasComposite.cs
│ │ ├── CanvasEdgeBehavior.cs
│ │ ├── ColorConversion.cs
│ │ ├── ColorSourceEffect.cs
│ │ ├── CompositeEffect.cs
│ │ ├── CrossFadeEffect.cs
│ │ ├── DesktopAcrylicBackdrop.cs
│ │ ├── DesktopAcrylicKind.cs
│ │ ├── EffectBorderMode.cs
│ │ ├── EffectOptimization.cs
│ │ ├── GaussianBlurEffect.cs
│ │ ├── MicaBackdrop.cs
│ │ ├── MicaKind.cs
│ │ ├── OpacityEffect.cs
│ │ └── SystemBackdrop.cs
└── WindowsAPI
│ ├── ComTypes
│ ├── D2D1_BUFFER_PRECISION.cs
│ ├── GRAPHICS_EFFECT_PROPERTY_MAPPING.cs
│ ├── ICompositorDesktopInterop.cs
│ ├── IGraphicsEffectD2D1Interop.cs
│ └── IPropertyValueStatics.cs
│ └── PInvoke
│ ├── Combase
│ └── CombaseLibrary.cs
│ ├── Comctl32
│ ├── Comctl32Library.cs
│ └── SUBCLASSPROC.cs
│ ├── Kernel32
│ ├── Kernel32Library.cs
│ └── SYSTEM_POWER_STATUS.cs
│ └── User32
│ ├── POWERBROADCAST_SETTING.cs
│ ├── User32Library.cs
│ └── WindowMessage.cs
└── ReadMe.md
/.editorconfig:
--------------------------------------------------------------------------------
1 | ##
2 | ## PROJECT: Mouri Internal Library Essentials
3 | ## FILE: .editorconfig
4 | ## PURPOSE: The root .editorconfig file
5 | ##
6 | ## LICENSE: The MIT License
7 | ##
8 | ## MAINTAINER: MouriNaruto (Kenji.Mouri@outlook.com)
9 | ##
10 |
11 | root = true
12 |
13 | [*]
14 | charset = utf-8-bom
15 | end_of_line = crlf
16 |
17 | [*.md]
18 | insert_final_newline = true
19 |
20 | [*.{c,c++,cc,cpp,cxx,h,h++,hh,hpp,hxx,ixx,cppm,ipp,odl,idl,inl,ipp,tlh,tli}]
21 | indent_style = space
22 | indent_size = 4
23 | insert_final_newline = true
24 | trim_trailing_whitespace = true
25 | vc_generate_documentation_comments = doxygen_slash_star
26 |
27 | [*.{cs,csx,vb,vbx,asmx}]
28 | indent_style = space
29 | indent_size = 4
30 | insert_final_newline = true
31 | trim_trailing_whitespace = true
32 |
33 | [*.{js,json,xml,toml,xaml}]
34 | indent_style = space
35 | indent_size = 2
36 | insert_final_newline = true
37 | trim_trailing_whitespace = true
38 |
39 | [*.rc]
40 | charset = utf-16le
41 |
42 | [*.inf]
43 | charset = utf-16le
44 |
45 | [*.bat]
46 | charset = utf-8
47 | insert_final_newline = true
48 |
49 | [*.sh]
50 | charset = utf-8
51 | end_of_line = lf
52 | insert_final_newline = true
53 |
54 | [*.{asm,inc,s,nasm}]
55 | charset = utf-8
56 | indent_style = space
57 | indent_size = 4
58 | insert_final_newline = true
59 | trim_trailing_whitespace = true
60 |
--------------------------------------------------------------------------------
/.github/FUNDING.yml:
--------------------------------------------------------------------------------
1 | patreon: MouriNaruto
2 | custom: [
3 | "https://paypal.me/MouriNaruto",
4 | "https://afdian.net/a/MouriNaruto",
5 | "https://github.com/MouriNaruto/MouriNaruto/tree/main/Sponsor#alipay",
6 | "https://github.com/MouriNaruto/MouriNaruto/tree/main/Sponsor#wechat"
7 | ]
8 |
--------------------------------------------------------------------------------
/.github/workflows/BuildBinaries.yml:
--------------------------------------------------------------------------------
1 | name: Build Binaries
2 |
3 | on:
4 | push:
5 | paths-ignore:
6 | - '.github/*'
7 | - '*.md'
8 | pull_request:
9 | paths-ignore:
10 | - '.github/*'
11 | - '*.md'
12 |
13 | jobs:
14 | build:
15 | runs-on: windows-latest
16 | env:
17 | POWERSHELL_TELEMETRY_OPTOUT: 1
18 | steps:
19 | - uses: actions/checkout@v4
20 | with:
21 | submodules: 'recursive'
22 | - uses: microsoft/setup-msbuild@v2
23 | - name: Clear local NuGet cache (workaround for failed restores on windows-latest)
24 | run: dotnet nuget locals all --clear
25 | - name: Build
26 | run: msbuild BuildAllTargets.proj
27 | - name: Prepare artifacts
28 | run: rm Output\Binaries\* -vb -Recurse -Force -Include *.exp, *.idb, *.ilk, *.iobj, *.ipdb, *.lastbuildstate, *.lib, *.obj, *.res, *.tlog
29 | - uses: actions/upload-artifact@v4
30 | with:
31 | name: Mile.Xaml.Samples_CI_Build
32 | path: Output\Binaries
33 |
--------------------------------------------------------------------------------
/.gitmodules:
--------------------------------------------------------------------------------
1 | [submodule "Mile.Project.Windows"]
2 | path = Mile.Project.Windows
3 | url = https://github.com/ProjectMile/Mile.Project.Windows
4 |
--------------------------------------------------------------------------------
/BuildAllTargets.cmd:
--------------------------------------------------------------------------------
1 | @setlocal
2 | @echo off
3 |
4 | rem Change to the current folder.
5 | cd "%~dp0"
6 |
7 | rem Remove the output folder for a fresh compile.
8 | rd /s /q Output
9 |
10 | rem Initialize Visual Studio environment
11 | call "%~dp0Mile.Project.Windows\InitializeVisualStudioEnvironment.cmd"
12 |
13 | rem Build all targets
14 | MSBuild -binaryLogger:Output\BuildAllTargets.binlog -m BuildAllTargets.proj
15 |
16 | @endlocal
--------------------------------------------------------------------------------
/BuildAllTargets.proj:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 |
8 | Configuration=Debug;Platform=x64
9 |
10 |
11 | Configuration=Release;Platform=x64
12 |
13 |
14 |
19 |
20 |
21 |
22 |
23 | Configuration=Debug;Platform=x86
24 |
25 |
26 | Configuration=Release;Platform=x86
27 |
28 |
29 | Configuration=Debug;Platform=x64
30 |
31 |
32 | Configuration=Release;Platform=x64
33 |
34 |
35 | Configuration=Debug;Platform=ARM64
36 |
37 |
38 | Configuration=Release;Platform=ARM64
39 |
40 |
41 |
47 |
48 |
--------------------------------------------------------------------------------
/Directory.Build.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
8 |
--------------------------------------------------------------------------------
/License.md:
--------------------------------------------------------------------------------
1 | MIT License
2 |
3 | Copyright (c) Kenji Mouri. All rights reserved.
4 |
5 | Permission is hereby granted, free of charge, to any person obtaining a copy
6 | of this software and associated documentation files (the "Software"), to deal
7 | in the Software without restriction, including without limitation the rights
8 | to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9 | copies of the Software, and to permit persons to whom the Software is
10 | furnished to do so, subject to the following conditions:
11 |
12 | The above copyright notice and this permission notice shall be included in all
13 | copies or substantial portions of the Software.
14 |
15 | THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16 | IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17 | FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18 | AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19 | LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20 | OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21 | SOFTWARE.
22 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/App.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | #include "App.h"
4 | #include "MainPage.h"
5 |
6 | using namespace winrt;
7 | using namespace Windows::ApplicationModel;
8 | using namespace Windows::ApplicationModel::Activation;
9 | using namespace Windows::Foundation;
10 | using namespace Windows::UI::Xaml;
11 | using namespace Windows::UI::Xaml::Controls;
12 | using namespace Windows::UI::Xaml::Navigation;
13 | using namespace MileXamlBlankApp;
14 | using namespace MileXamlBlankApp::implementation;
15 |
16 | #include
17 |
18 | namespace winrt::MileXamlBlankApp::implementation
19 | {
20 | App::App()
21 | {
22 | ::MileXamlGlobalInitialize();
23 | }
24 |
25 | void App::Close()
26 | {
27 | Exit();
28 | ::MileXamlGlobalUninitialize();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/App.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "App.xaml.g.h"
3 |
4 | namespace winrt::MileXamlBlankApp::implementation
5 | {
6 | class App : public AppT
7 | {
8 | public:
9 | App();
10 | void Close();
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/App.idl:
--------------------------------------------------------------------------------
1 | namespace MileXamlBlankApp
2 | {
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/MainPage.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "MainPage.h"
3 | #include "MainPage.g.cpp"
4 |
5 | using namespace winrt;
6 | using namespace Windows::UI::Xaml;
7 |
8 | namespace winrt::MileXamlBlankApp::implementation
9 | {
10 | void MainPage::InitializeComponent()
11 | {
12 | MainPageT::InitializeComponent();
13 | }
14 |
15 | int32_t MainPage::MyProperty()
16 | {
17 | throw hresult_not_implemented();
18 | }
19 |
20 | void MainPage::MyProperty(int32_t /* value */)
21 | {
22 | throw hresult_not_implemented();
23 | }
24 |
25 | void MainPage::ClickHandler(IInspectable const&, RoutedEventArgs const&)
26 | {
27 | Button().Content(box_value(L"Clicked"));
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/MainPage.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "MainPage.g.h"
4 |
5 | namespace winrt::MileXamlBlankApp::implementation
6 | {
7 | struct MainPage : MainPageT
8 | {
9 | MainPage() = default;
10 |
11 | void InitializeComponent();
12 |
13 | int32_t MyProperty();
14 | void MyProperty(int32_t value);
15 |
16 | void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
17 | };
18 | }
19 |
20 | namespace winrt::MileXamlBlankApp::factory_implementation
21 | {
22 | struct MainPage : MainPageT
23 | {
24 | };
25 | }
26 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/MainPage.idl:
--------------------------------------------------------------------------------
1 | namespace MileXamlBlankApp
2 | {
3 | [default_interface]
4 | runtimeclass MainPage : Windows.UI.Xaml.Controls.Page
5 | {
6 | MainPage();
7 | Int32 MyProperty;
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
8 |
12 |
13 |
14 |
15 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/MileXamlBlankApp.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 |
14 |
15 |
16 | PerMonitorV2
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/MileXamlBlankApp.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {B30D3882-3C80-4C8C-B64C-52FB9083F5D7}
5 | MileXamlBlankApp
6 | MileXamlBlankApp
7 | WindowsApplication
8 | MileXamlBlankApp.manifest
9 | false
10 | en-US
11 | 15.0
12 | false
13 | false
14 | Windows Store
15 | 10.0
16 | 10.0.19041.0
17 | true
18 | true
19 | true
20 | Project Mile
21 | Mile.Xaml Blank App Sample
22 | MileXamlBlankApp
23 | © Project Mile. All rights reserved.
24 | MileXamlBlankApp.exe
25 | Mile.Xaml
26 | 1.0.0.0
27 | Alpha 1
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | $(MileProjectBinariesPath)$(Configuration)\$(Platform)\$(ProjectName)\
39 |
40 |
41 |
42 | runtimeobject.lib;%(AdditionalDependencies)
43 |
44 |
45 |
46 |
47 |
48 | App.xaml
49 |
50 |
51 | MainPage.xaml
52 |
53 |
54 |
55 |
56 | Designer
57 |
58 |
59 | Designer
60 |
61 |
62 |
63 |
64 | Create
65 |
66 |
67 | App.xaml
68 |
69 |
70 | MainPage.xaml
71 |
72 |
73 |
74 |
75 |
76 |
77 | App.xaml
78 |
79 |
80 | MainPage.xaml
81 |
82 |
83 |
84 |
85 |
86 |
87 |
88 |
89 |
90 |
91 | 2.5.1250
92 |
93 |
94 |
95 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/WinMain.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "pch.h"
4 |
5 | #include "App.h"
6 | #include "MainPage.h"
7 |
8 | int WINAPI wWinMain(
9 | _In_ HINSTANCE hInstance,
10 | _In_opt_ HINSTANCE hPrevInstance,
11 | _In_ LPWSTR lpCmdLine,
12 | _In_ int nShowCmd)
13 | {
14 | UNREFERENCED_PARAMETER(hPrevInstance);
15 | UNREFERENCED_PARAMETER(lpCmdLine);
16 |
17 | winrt::init_apartment(winrt::apartment_type::single_threaded);
18 |
19 | winrt::com_ptr app =
20 | winrt::make_self();
21 |
22 | winrt::MileXamlBlankApp::MainPage XamlWindowContent =
23 | winrt::make();
24 |
25 | HWND WindowHandle = ::CreateWindowExW(
26 | WS_EX_CLIENTEDGE,
27 | L"Mile.Xaml.ContentWindow",
28 | L"MileXamlBlankApp",
29 | WS_OVERLAPPEDWINDOW,
30 | CW_USEDEFAULT,
31 | 0,
32 | CW_USEDEFAULT,
33 | 0,
34 | nullptr,
35 | nullptr,
36 | hInstance,
37 | winrt::get_abi(XamlWindowContent));
38 | if (!WindowHandle)
39 | {
40 | return -1;
41 | }
42 |
43 | ::ShowWindow(WindowHandle, nShowCmd);
44 | ::UpdateWindow(WindowHandle);
45 |
46 | MSG Message;
47 | while (::GetMessageW(&Message, nullptr, 0, 0))
48 | {
49 | // Workaround for capturing Alt+F4 in applications with XAML Islands.
50 | // Reference: https://github.com/microsoft/microsoft-ui-xaml/issues/2408
51 | if (Message.message == WM_SYSKEYDOWN && Message.wParam == VK_F4)
52 | {
53 | ::SendMessageW(
54 | ::GetAncestor(Message.hwnd, GA_ROOT),
55 | Message.message,
56 | Message.wParam,
57 | Message.lParam);
58 |
59 | continue;
60 | }
61 |
62 | ::TranslateMessage(&Message);
63 | ::DispatchMessageW(&Message);
64 | }
65 |
66 | app->Close();
67 |
68 | return static_cast(Message.wParam);
69 | }
70 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/MileXamlBlankApp/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | // https://github.com/microsoft/terminal
5 | // /blob/c727762602b8bd12e4a3a769053204d7e92b81c5
6 | // /src/cascadia/WindowsTerminalUniversal/pch.h#L12
7 | // This is inexplicable, but for whatever reason, cppwinrt conflicts with the
8 | // SDK definition of this function, so the only fix is to undef it.
9 | // from WinBase.h
10 | // Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
11 | #ifdef GetCurrentTime
12 | #undef GetCurrentTime
13 | #endif
14 |
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/App.manifest:
--------------------------------------------------------------------------------
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 | False
26 | False
27 | True/PM
28 | True
29 | True
30 | True
31 | True
32 | False
33 | PerMonitorV2, PerMonitor, System, Unaware
34 | True
35 | False
36 | UTF-8
37 | SegmentHeap
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using Windows.UI.Xaml;
3 |
4 | namespace MileXamlBlankAppNetCore
5 | {
6 | sealed partial class App : Application
7 | {
8 | public App()
9 | {
10 | this.ThreadInitialize();
11 | this.InitializeComponent();
12 | }
13 |
14 | public void Close()
15 | {
16 | this.Exit();
17 | this.ThreadUninitialize();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlBlankAppNetCore
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | SuspendLayout();
32 | //
33 | // Form1
34 | //
35 | AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
36 | AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | ClientSize = new System.Drawing.Size(1000, 700);
38 | Name = "Form1";
39 | Text = "MileXamlBlankApp (Modern .Net)";
40 | ResumeLayout(false);
41 | }
42 |
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/Form1.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace MileXamlBlankAppNetCore
6 | {
7 | public partial class Form1 : Form
8 | {
9 | WindowsXamlHost xamlHost = new WindowsXamlHost();
10 |
11 | public Form1()
12 | {
13 | InitializeComponent();
14 |
15 |
16 | this.Controls.Add(xamlHost);
17 | xamlHost.AutoSize = true;
18 | xamlHost.Dock = DockStyle.Fill;
19 | xamlHost.Child = new MainPage();
20 |
21 | this.Load += Form1_Load;
22 | }
23 |
24 | private void Form1_Load(object sender, EventArgs e)
25 | {
26 |
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
19 |
20 |
21 | IsDynamicCodeSupported:
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Windows.UI.Xaml;
5 | using Windows.UI.Xaml.Controls;
6 |
7 | namespace MileXamlBlankAppNetCore
8 | {
9 | public sealed partial class MainPage : Page
10 | {
11 | public string FrameworkDescription => RuntimeInformation.FrameworkDescription;
12 | public bool IsDynamicCodeSupported => RuntimeFeature.IsDynamicCodeSupported;
13 |
14 | public MainPage()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | private async void Button_Click(object sender, RoutedEventArgs e)
20 | {
21 | var contentDialog = new ContentDialog
22 | {
23 | Title = "Hello world",
24 | Content = "Where do you want to go today?",
25 | PrimaryButtonText = "OK",
26 | XamlRoot = (sender as Button).XamlRoot,
27 | };
28 | await contentDialog.ShowAsync();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/MileXamlBlankAppNetCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net9.0-windows10.0.26100.0
6 | 10.0.26100.0
7 | 10.0.19041.0
8 | latest
9 | App.manifest
10 | true
11 | true
12 | win-x86;win-x64;win-arm64
13 | resources.pri
14 | <_SuppressWinFormsTrimError>true
15 | true
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 | $(ProjectPriFileName)
28 | PreserveNewest
29 |
30 |
31 |
32 |
33 |
34 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace MileXamlBlankAppNetCore
5 | {
6 | public static class Program
7 | {
8 | public static Form MainForm { get; private set; }
9 |
10 | [STAThread]
11 | private static void Main()
12 | {
13 | Application.EnableVisualStyles();
14 | Application.SetCompatibleTextRenderingDefault(false);
15 |
16 | App app = new();
17 |
18 | MainForm = new Form1();
19 | Application.Run(MainForm);
20 |
21 | app.Close();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/Properties/PublishProfiles/win-arm64.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | win-arm64
9 | net9.0-windows10.0.26100.0
10 | ..\Output\Binaries\$(Configuration)\$(TargetFramework)\publish\$(RuntimeIdentifier)\
11 | FileSystem
12 | <_TargetId>Folder
13 | true
14 |
15 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/Properties/PublishProfiles/win-x64.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | win-x64
9 | net9.0-windows10.0.26100.0
10 | ..\Output\Binaries\$(Configuration)\$(TargetFramework)\publish\$(RuntimeIdentifier)\
11 | FileSystem
12 | <_TargetId>Folder
13 | true
14 |
15 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCore/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "MileXamlBlankAppNetCore": {
4 | "commandName": "Project",
5 | "nativeDebugging": false
6 | }
7 | }
8 | }
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/App.manifest:
--------------------------------------------------------------------------------
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 | False
26 | False
27 | True/PM
28 | True
29 | True
30 | True
31 | True
32 | False
33 | PerMonitorV2, PerMonitor, System, Unaware
34 | True
35 | False
36 | UTF-8
37 | SegmentHeap
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using Windows.UI.Xaml;
3 |
4 | namespace MileXamlBlankAppNetCore
5 | {
6 | sealed partial class App : Application
7 | {
8 | public App()
9 | {
10 | NativeWrapper.MileXamlGlobalInitialize();
11 | this.InitializeComponent();
12 | }
13 |
14 | public void Close()
15 | {
16 | this.Exit();
17 | NativeWrapper.MileXamlGlobalUninitialize();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
19 |
20 |
21 | IsDynamicCodeSupported:
22 |
23 |
24 | Native Backend
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Windows.UI.Xaml;
5 | using Windows.UI.Xaml.Controls;
6 |
7 | namespace MileXamlBlankAppNetCore
8 | {
9 | public sealed partial class MainPage : Page
10 | {
11 | public string FrameworkDescription => RuntimeInformation.FrameworkDescription;
12 | public bool IsDynamicCodeSupported => RuntimeFeature.IsDynamicCodeSupported;
13 |
14 | public MainPage()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | private async void Button_Click(object sender, RoutedEventArgs e)
20 | {
21 | var contentDialog = new ContentDialog
22 | {
23 | Title = "Hello world",
24 | Content = "Where do you want to go today?",
25 | PrimaryButtonText = "OK",
26 | XamlRoot = (sender as Button).XamlRoot,
27 | };
28 | await contentDialog.ShowAsync();
29 | }
30 | }
31 | }
32 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/MileXamlBlankAppNetCoreNativeBackend.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | x86;x64;ARM64
6 | net9.0-windows10.0.26100.0
7 | 10.0.26100.0
8 | 10.0.19041.0
9 | latest
10 | App.manifest
11 | true
12 | win-x86;win-x64;win-arm64
13 | resources.pri
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
31 |
32 | $(ProjectPriFileName)
33 | PreserveNewest
34 |
35 |
36 |
37 |
38 |
39 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/NativeWrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Mile.Xaml
5 | {
6 | public class NativeWrapper
7 | {
8 | [DllImport("Mile.Xaml.dll")]
9 | public static extern IntPtr MileXamlGetCoreWindowHandle();
10 |
11 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
12 | public static extern void MileXamlSetXamlContentForContentWindow(
13 | IntPtr WindowHandle,
14 | IntPtr XamlContent);
15 |
16 | [DllImport("Mile.Xaml.dll")]
17 | public static extern IntPtr MileXamlContentWindowDefaultCallback(
18 | IntPtr hWnd,
19 | uint uMsg,
20 | IntPtr wParam,
21 | IntPtr lParam);
22 |
23 | [DllImport("Mile.Xaml.dll")]
24 | public static extern int MileXamlContentWindowDefaultMessageLoop();
25 |
26 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
27 | public static extern void MileXamlGetTransparentBackgroundAttribute(
28 | out bool TransparentBackground);
29 |
30 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
31 | public static extern void MileXamlSetTransparentBackgroundAttribute(
32 | bool TransparentBackground);
33 |
34 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
35 | public static extern void MileXamlGetPreferredDarkModeAttribute(
36 | out bool PreferredDarkMode);
37 |
38 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
39 | public static extern void MileXamlSetPreferredDarkModeAttribute(
40 | bool PreferredDarkMode);
41 |
42 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
43 | public static extern void MileXamlThreadInitialize();
44 |
45 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
46 | public static extern void MileXamlThreadUninitialize();
47 |
48 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
49 | public static extern void MileXamlGlobalInitialize();
50 |
51 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
52 | public static extern void MileXamlGlobalUninitialize();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/Program.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using System;
3 | using System.Runtime.InteropServices;
4 | using WinRT;
5 |
6 | namespace MileXamlBlankAppNetCore
7 | {
8 |
9 | public static class Program
10 | {
11 | [Flags]
12 | enum WS_EX : uint
13 | {
14 | None = 0,
15 | DLGMODALFRAME = 0x00000001,
16 | NOPARENTNOTIFY = 0x00000004,
17 | TOPMOST = 0x00000008,
18 | ACCEPTFILES = 0x00000010,
19 | TRANSPARENT = 0x00000020,
20 | MDICHILD = 0x00000040,
21 | TOOLWINDOW = 0x00000080,
22 | WINDOWEDGE = 0x00000100,
23 | CLIENTEDGE = 0x00000200,
24 | CONTEXTHELP = 0x00000400,
25 | RIGHT = 0x00001000,
26 | LEFT = 0x00000000,
27 | RTLREADING = 0x00002000,
28 | LTRREADING = 0x00000000,
29 | LEFTSCROLLBAR = 0x00004000,
30 | RIGHTSCROLLBAR = 0x00000000,
31 | CONTROLPARENT = 0x00010000,
32 | STATICEDGE = 0x00020000,
33 | APPWINDOW = 0x00040000,
34 | LAYERED = 0x00080000,
35 | NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
36 | LAYOUTRTL = 0x00400000, // Right to left mirroring
37 | COMPOSITED = 0x02000000,
38 | NOACTIVATE = 0x08000000,
39 | OVERLAPPEDWINDOW = (WINDOWEDGE | CLIENTEDGE),
40 | PALETTEWINDOW = (WINDOWEDGE | TOOLWINDOW | TOPMOST),
41 | }
42 |
43 | [Flags]
44 | enum WS : uint
45 | {
46 | OVERLAPPED = 0x00000000,
47 | POPUP = 0x80000000,
48 | CHILD = 0x40000000,
49 | MINIMIZE = 0x20000000,
50 | VISIBLE = 0x10000000,
51 | DISABLED = 0x08000000,
52 | CLIPSIBLINGS = 0x04000000,
53 | CLIPCHILDREN = 0x02000000,
54 | MAXIMIZE = 0x01000000,
55 | BORDER = 0x00800000,
56 | DLGFRAME = 0x00400000,
57 | VSCROLL = 0x00200000,
58 | HSCROLL = 0x00100000,
59 | SYSMENU = 0x00080000,
60 | THICKFRAME = 0x00040000,
61 | GROUP = 0x00020000,
62 | TABSTOP = 0x00010000,
63 |
64 | MINIMIZEBOX = 0x00020000,
65 | MAXIMIZEBOX = 0x00010000,
66 |
67 | CAPTION = BORDER | DLGFRAME,
68 | TILED = OVERLAPPED,
69 | ICONIC = MINIMIZE,
70 | SIZEBOX = THICKFRAME,
71 | TILEDWINDOW = OVERLAPPEDWINDOW,
72 |
73 | OVERLAPPEDWINDOW = OVERLAPPED | CAPTION | SYSMENU | THICKFRAME | MINIMIZEBOX | MAXIMIZEBOX,
74 | POPUPWINDOW = POPUP | BORDER | SYSMENU,
75 | CHILDWINDOW = CHILD,
76 | }
77 |
78 | public const int CW_USEDEFAULT = (unchecked((int)0x80000000));
79 |
80 | [DllImport("user32.dll", CharSet = CharSet.Unicode)]
81 | static extern IntPtr CreateWindowEx(
82 | WS_EX dwExStyle,
83 | string lpClassName,
84 | string lpWindowName,
85 | WS dwStyle,
86 | int X,
87 | int Y,
88 | int nWidth,
89 | int nHeight,
90 | IntPtr hWndParent,
91 | IntPtr hMenu,
92 | IntPtr hInstance,
93 | IntPtr lpParam);
94 |
95 | [DllImport("user32.dll")]
96 | static extern bool UpdateWindow(
97 | IntPtr hWnd);
98 |
99 | enum SW
100 | {
101 | HIDE = 0,
102 | SHOWNORMAL = 1,
103 | NORMAL = 1,
104 | SHOWMINIMIZED = 2,
105 | SHOWMAXIMIZED = 3,
106 | MAXIMIZE = 3,
107 | SHOWNOACTIVATE = 4,
108 | SHOW = 5,
109 | MINIMIZE = 6,
110 | SHOWMINNOACTIVE = 7,
111 | SHOWNA = 8,
112 | RESTORE = 9,
113 | SHOWDEFAULT = 10,
114 | FORCEMINIMIZE = 11,
115 | }
116 |
117 | [DllImport("user32.dll")]
118 | static extern bool ShowWindow(
119 | IntPtr hWnd,
120 | SW nCmdShow);
121 |
122 | [STAThread]
123 | private static void Main()
124 | {
125 | App app = new();
126 | MainPage Content = new MainPage();
127 |
128 | IntPtr WindowHandle = CreateWindowEx(
129 | WS_EX.CLIENTEDGE,
130 | "Mile.Xaml.ContentWindow",
131 | "MileXamlBlankApp (Modern .Net)",
132 | WS.OVERLAPPEDWINDOW,
133 | CW_USEDEFAULT,
134 | 0,
135 | CW_USEDEFAULT,
136 | 0,
137 | IntPtr.Zero,
138 | IntPtr.Zero,
139 | IntPtr.Zero,
140 | MarshalInspectable.FromManaged(Content));
141 |
142 | ShowWindow(WindowHandle, SW.SHOW);
143 | UpdateWindow(WindowHandle);
144 |
145 | NativeWrapper.MileXamlContentWindowDefaultMessageLoop();
146 |
147 | app.Close();
148 | }
149 | }
150 | }
151 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/Properties/PublishProfiles/win-arm64.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | ARM64
9 | win-arm64
10 | net9.0-windows10.0.26100.0
11 | ..\Output\Binaries\$(Configuration)\$(TargetFramework)\publish\$(RuntimeIdentifier)\
12 | FileSystem
13 | <_TargetId>Folder
14 | true
15 |
16 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/Properties/PublishProfiles/win-x64.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | x64
9 | win-x64
10 | net9.0-windows10.0.26100.0
11 | ..\Output\Binaries\$(Configuration)\$(TargetFramework)\publish\$(RuntimeIdentifier)\
12 | FileSystem
13 | <_TargetId>Folder
14 | true
15 |
16 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetCoreNativeBackend/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "MileXamlBlankAppNetCoreNativeBackend": {
4 | "commandName": "Project",
5 | "nativeDebugging": false
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/App.manifest:
--------------------------------------------------------------------------------
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 | False
26 | False
27 | True/PM
28 | True
29 | True
30 | True
31 | True
32 | False
33 | PerMonitorV2, PerMonitor, System, Unaware
34 | True
35 | False
36 | UTF-8
37 | SegmentHeap
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using Windows.UI.Xaml;
3 |
4 | namespace MileXamlBlankAppNetFrameworkModern
5 | {
6 | sealed partial class App : Application
7 | {
8 | public App()
9 | {
10 | this.ThreadInitialize();
11 | this.InitializeComponent();
12 | }
13 |
14 | public void Close()
15 | {
16 | this.Exit();
17 | this.ThreadUninitialize();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlBlankAppNetFramework
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // Form1
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.ClientSize = new System.Drawing.Size(1600, 900);
38 | this.Name = "Form1";
39 | this.Text = "MileXamlBlankApp (.Net Framework)";
40 | this.ResumeLayout(false);
41 |
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/Form1.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using MileXamlBlankAppNetFrameworkModern;
3 | using System;
4 | using System.Windows.Forms;
5 | using Windows.UI.Xaml;
6 |
7 | namespace MileXamlBlankAppNetFramework
8 | {
9 | public partial class Form1 : Form
10 | {
11 | WindowsXamlHost xamlHost = new WindowsXamlHost();
12 |
13 | public Form1()
14 | {
15 | InitializeComponent();
16 |
17 |
18 | this.Controls.Add(xamlHost);
19 | xamlHost.AutoSize = true;
20 | xamlHost.Dock = DockStyle.Fill;
21 | xamlHost.Child = new MainPage();
22 |
23 | this.Load += Form1_Load;
24 |
25 | //ContainerControl control = new ContainerControl();
26 | //this.Controls.Add(control);
27 | //control.Dock = DockStyle.Fill;
28 | }
29 |
30 | private void Form1_Load(object sender, EventArgs e)
31 | {
32 |
33 | }
34 | }
35 | }
36 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
9 |
10 |
14 |
15 |
16 | Native Backend
17 |
18 |
19 |
20 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.UI.Xaml;
4 | using Windows.UI.Xaml.Controls;
5 |
6 | namespace MileXamlBlankAppNetFrameworkModern
7 | {
8 | public sealed partial class MainPage : Page
9 | {
10 | public string FrameworkDescription => RuntimeInformation.FrameworkDescription;
11 |
12 | public MainPage()
13 | {
14 | InitializeComponent();
15 | }
16 |
17 | private async void Button_Click(object sender, RoutedEventArgs e)
18 | {
19 | var contentDialog = new ContentDialog
20 | {
21 |
22 | Title = "Hello world",
23 | Content = "Where do you want to go today?",
24 | PrimaryButtonText = "OK",
25 | XamlRoot = (sender as Button).XamlRoot,
26 | };
27 | await contentDialog.ShowAsync();
28 | }
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/MileXamlBlankAppNetFramework.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net48
6 | 10.0.22621.0
7 | 10.0.19041.0
8 | latest
9 | App.manifest
10 | true
11 | true
12 |
13 | $(TargetPlatformMinVersion)
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFramework/Program.cs:
--------------------------------------------------------------------------------
1 | using MileXamlBlankAppNetFramework;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace MileXamlBlankAppNetFrameworkModern
6 | {
7 | public static class Program
8 | {
9 | public static Form MainForm { get; private set; }
10 |
11 | [STAThread]
12 | private static void Main()
13 | {
14 | Application.EnableVisualStyles();
15 | Application.SetCompatibleTextRenderingDefault(false);
16 |
17 | App app = new();
18 |
19 | MainForm = new Form1();
20 | Application.Run(MainForm);
21 |
22 | app.Close();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/App.manifest:
--------------------------------------------------------------------------------
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 | False
26 | False
27 | True/PM
28 | True
29 | True
30 | True
31 | True
32 | False
33 | PerMonitorV2, PerMonitor, System, Unaware
34 | True
35 | False
36 | UTF-8
37 | SegmentHeap
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using Windows.UI.Xaml;
3 |
4 | namespace MileXamlBlankAppNetFrameworkNativeBackend
5 | {
6 | sealed partial class App : Application
7 | {
8 | public App()
9 | {
10 | NativeWrapper.MileXamlGlobalInitialize();
11 | this.InitializeComponent();
12 | }
13 |
14 | public void Close()
15 | {
16 | this.Exit();
17 | NativeWrapper.MileXamlGlobalUninitialize();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/MainPage.xaml:
--------------------------------------------------------------------------------
1 |
10 |
11 |
15 |
16 |
17 | Native Backend
18 |
19 |
20 |
21 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/MainPage.xaml.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.CompilerServices;
3 | using System.Runtime.InteropServices;
4 | using Windows.UI.Xaml;
5 | using Windows.UI.Xaml.Controls;
6 |
7 | namespace MileXamlBlankAppNetFrameworkNativeBackend
8 | {
9 |
10 | public sealed partial class MainPage : Page
11 | {
12 | public string FrameworkDescription => RuntimeInformation.FrameworkDescription;
13 |
14 | public MainPage()
15 | {
16 | InitializeComponent();
17 | }
18 |
19 | private async void Button_Click(object sender, RoutedEventArgs e)
20 | {
21 | var contentDialog = new ContentDialog
22 | {
23 |
24 | Title = "Hello world",
25 | Content = "Where do you want to go today?",
26 | PrimaryButtonText = "OK",
27 | XamlRoot = (sender as Button).XamlRoot,
28 | };
29 | await contentDialog.ShowAsync();
30 | }
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/MileXamlBlankAppNetFrameworkNativeBackend.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net48
6 | 10.0.22621.0
7 | 10.0.19041.0
8 | latest
9 | App.manifest
10 | true
11 |
12 | $(TargetPlatformMinVersion)
13 | x64
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Always
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/NativeWrapper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace Mile.Xaml
5 | {
6 | public class NativeWrapper
7 | {
8 | [DllImport("Mile.Xaml.dll")]
9 | public static extern IntPtr MileXamlGetCoreWindowHandle();
10 |
11 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
12 | public static extern void MileXamlSetXamlContentForContentWindow(
13 | IntPtr WindowHandle,
14 | IntPtr XamlContent);
15 |
16 | [DllImport("Mile.Xaml.dll")]
17 | public static extern IntPtr MileXamlContentWindowDefaultCallback(
18 | IntPtr hWnd,
19 | uint uMsg,
20 | IntPtr wParam,
21 | IntPtr lParam);
22 |
23 | [DllImport("Mile.Xaml.dll")]
24 | public static extern int MileXamlContentWindowDefaultMessageLoop();
25 |
26 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
27 | public static extern void MileXamlGetTransparentBackgroundAttribute(
28 | out bool TransparentBackground);
29 |
30 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
31 | public static extern void MileXamlSetTransparentBackgroundAttribute(
32 | bool TransparentBackground);
33 |
34 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
35 | public static extern void MileXamlGetPreferredDarkModeAttribute(
36 | out bool PreferredDarkMode);
37 |
38 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
39 | public static extern void MileXamlSetPreferredDarkModeAttribute(
40 | bool PreferredDarkMode);
41 |
42 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
43 | public static extern void MileXamlThreadInitialize();
44 |
45 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
46 | public static extern void MileXamlThreadUninitialize();
47 |
48 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
49 | public static extern void MileXamlGlobalInitialize();
50 |
51 | [DllImport("Mile.Xaml.dll", PreserveSig = true)]
52 | public static extern void MileXamlGlobalUninitialize();
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkNativeBackend/Program.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using System;
3 | using System.Runtime.InteropServices;
4 |
5 | namespace MileXamlBlankAppNetFrameworkNativeBackend
6 | {
7 | public static class Program
8 | {
9 | [Flags]
10 | enum WS_EX : uint
11 | {
12 | None = 0,
13 | DLGMODALFRAME = 0x00000001,
14 | NOPARENTNOTIFY = 0x00000004,
15 | TOPMOST = 0x00000008,
16 | ACCEPTFILES = 0x00000010,
17 | TRANSPARENT = 0x00000020,
18 | MDICHILD = 0x00000040,
19 | TOOLWINDOW = 0x00000080,
20 | WINDOWEDGE = 0x00000100,
21 | CLIENTEDGE = 0x00000200,
22 | CONTEXTHELP = 0x00000400,
23 | RIGHT = 0x00001000,
24 | LEFT = 0x00000000,
25 | RTLREADING = 0x00002000,
26 | LTRREADING = 0x00000000,
27 | LEFTSCROLLBAR = 0x00004000,
28 | RIGHTSCROLLBAR = 0x00000000,
29 | CONTROLPARENT = 0x00010000,
30 | STATICEDGE = 0x00020000,
31 | APPWINDOW = 0x00040000,
32 | LAYERED = 0x00080000,
33 | NOINHERITLAYOUT = 0x00100000, // Disable inheritence of mirroring by children
34 | LAYOUTRTL = 0x00400000, // Right to left mirroring
35 | COMPOSITED = 0x02000000,
36 | NOACTIVATE = 0x08000000,
37 | OVERLAPPEDWINDOW = (WINDOWEDGE | CLIENTEDGE),
38 | PALETTEWINDOW = (WINDOWEDGE | TOOLWINDOW | TOPMOST),
39 | }
40 |
41 | [Flags]
42 | enum WS : uint
43 | {
44 | OVERLAPPED = 0x00000000,
45 | POPUP = 0x80000000,
46 | CHILD = 0x40000000,
47 | MINIMIZE = 0x20000000,
48 | VISIBLE = 0x10000000,
49 | DISABLED = 0x08000000,
50 | CLIPSIBLINGS = 0x04000000,
51 | CLIPCHILDREN = 0x02000000,
52 | MAXIMIZE = 0x01000000,
53 | BORDER = 0x00800000,
54 | DLGFRAME = 0x00400000,
55 | VSCROLL = 0x00200000,
56 | HSCROLL = 0x00100000,
57 | SYSMENU = 0x00080000,
58 | THICKFRAME = 0x00040000,
59 | GROUP = 0x00020000,
60 | TABSTOP = 0x00010000,
61 |
62 | MINIMIZEBOX = 0x00020000,
63 | MAXIMIZEBOX = 0x00010000,
64 |
65 | CAPTION = BORDER | DLGFRAME,
66 | TILED = OVERLAPPED,
67 | ICONIC = MINIMIZE,
68 | SIZEBOX = THICKFRAME,
69 | TILEDWINDOW = OVERLAPPEDWINDOW,
70 |
71 | OVERLAPPEDWINDOW = OVERLAPPED | CAPTION | SYSMENU | THICKFRAME | MINIMIZEBOX | MAXIMIZEBOX,
72 | POPUPWINDOW = POPUP | BORDER | SYSMENU,
73 | CHILDWINDOW = CHILD,
74 | }
75 |
76 | public const int CW_USEDEFAULT = (unchecked((int)0x80000000));
77 |
78 | [DllImport("user32.dll", CharSet = CharSet.Unicode)]
79 | static extern IntPtr CreateWindowEx(
80 | WS_EX dwExStyle,
81 | string lpClassName,
82 | string lpWindowName,
83 | WS dwStyle,
84 | int X,
85 | int Y,
86 | int nWidth,
87 | int nHeight,
88 | IntPtr hWndParent,
89 | IntPtr hMenu,
90 | IntPtr hInstance,
91 | IntPtr lpParam);
92 |
93 | [DllImport("user32.dll")]
94 | static extern bool UpdateWindow(
95 | IntPtr hWnd);
96 |
97 | enum SW
98 | {
99 | HIDE = 0,
100 | SHOWNORMAL = 1,
101 | NORMAL = 1,
102 | SHOWMINIMIZED = 2,
103 | SHOWMAXIMIZED = 3,
104 | MAXIMIZE = 3,
105 | SHOWNOACTIVATE = 4,
106 | SHOW = 5,
107 | MINIMIZE = 6,
108 | SHOWMINNOACTIVE = 7,
109 | SHOWNA = 8,
110 | RESTORE = 9,
111 | SHOWDEFAULT = 10,
112 | FORCEMINIMIZE = 11,
113 | }
114 |
115 | [DllImport("user32.dll")]
116 | static extern bool ShowWindow(
117 | IntPtr hWnd,
118 | SW nCmdShow);
119 |
120 | [STAThread]
121 | private static void Main()
122 | {
123 | App app = new();
124 |
125 | MainPage Content = new MainPage();
126 |
127 | IntPtr WindowHandle = CreateWindowEx(
128 | WS_EX.CLIENTEDGE,
129 | "Mile.Xaml.ContentWindow",
130 | "MileXamlBlankApp (.Net Framework)",
131 | WS.OVERLAPPEDWINDOW,
132 | CW_USEDEFAULT,
133 | 0,
134 | CW_USEDEFAULT,
135 | 0,
136 | IntPtr.Zero,
137 | IntPtr.Zero,
138 | IntPtr.Zero,
139 | Marshal.GetIUnknownForObject(Content));
140 |
141 | ShowWindow(WindowHandle, SW.SHOW);
142 | UpdateWindow(WindowHandle);
143 |
144 | NativeWrapper.MileXamlContentWindowDefaultMessageLoop();
145 |
146 | app.Close();
147 | }
148 | }
149 | }
150 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Images/LockScreenLogo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlBlankAppNetFrameworkPackage/Images/LockScreenLogo.scale-200.png
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Images/SplashScreen.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlBlankAppNetFrameworkPackage/Images/SplashScreen.scale-200.png
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Images/Square150x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlBlankAppNetFrameworkPackage/Images/Square150x150Logo.scale-200.png
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Images/Square44x44Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlBlankAppNetFrameworkPackage/Images/Square44x44Logo.scale-200.png
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlBlankAppNetFrameworkPackage/Images/Square44x44Logo.targetsize-24_altform-unplated.png
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Images/StoreLogo.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlBlankAppNetFrameworkPackage/Images/StoreLogo.png
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Images/Wide310x150Logo.scale-200.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlBlankAppNetFrameworkPackage/Images/Wide310x150Logo.scale-200.png
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/MileXamlBlankAppNetFrameworkPackage.wapproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | Debug
6 | AnyCPU
7 |
8 |
9 | Release
10 | AnyCPU
11 |
12 |
13 |
14 |
15 | 73f2781a-8ec6-40fb-ad81-7dfe9cc94f3c
16 | 10.0.22621.0
17 | 10.0.19041.0
18 | en
19 | false
20 | ..\MileXamlBlankAppNetFramework\MileXamlBlankAppNetFramework.csproj
21 | Mixed
22 |
23 |
24 |
25 | Designer
26 |
27 |
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
--------------------------------------------------------------------------------
/MileXamlBlankAppNetFrameworkPackage/Package.appxmanifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
8 |
9 |
13 |
14 |
15 | MileXamlBlankAppNetFrameworkPackage
16 | Mouri
17 | Images\StoreLogo.png
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
29 |
30 |
33 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
49 |
50 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/App.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
3 | #include "App.h"
4 | #include "MainPage.h"
5 |
6 | using namespace winrt;
7 | using namespace Windows::ApplicationModel;
8 | using namespace Windows::ApplicationModel::Activation;
9 | using namespace Windows::Foundation;
10 | using namespace Windows::UI::Xaml;
11 | using namespace Windows::UI::Xaml::Controls;
12 | using namespace Windows::UI::Xaml::Navigation;
13 | using namespace MileXamlControlsDemo;
14 | using namespace MileXamlControlsDemo::implementation;
15 |
16 | #include
17 |
18 | namespace winrt::MileXamlControlsDemo::implementation
19 | {
20 | App::App()
21 | {
22 | ::MileXamlGlobalInitialize();
23 | }
24 |
25 | void App::Close()
26 | {
27 | Exit();
28 | ::MileXamlGlobalUninitialize();
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/App.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include "App.xaml.g.h"
3 |
4 | namespace winrt::MileXamlControlsDemo::implementation
5 | {
6 | class App : public AppT
7 | {
8 | public:
9 | App();
10 | void Close();
11 | };
12 | }
13 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/App.idl:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemo
2 | {
3 |
4 | }
5 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/MainPage.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "MainPage.h"
3 | #include "MainPage.g.cpp"
4 |
5 | #include "winrt/Windows.Media.Core.h"
6 | #include "winrt/Windows.UI.Xaml.Controls.h"
7 | #include "winrt/Windows.System.h"
8 |
9 | #include "TreeViewItemModel.h"
10 |
11 | using namespace winrt;
12 | using namespace Windows::UI::Xaml;
13 |
14 | namespace winrt::MileXamlControlsDemo::implementation
15 | {
16 | void MainPage::InitializeComponent()
17 | {
18 | MainPageT::InitializeComponent();
19 | winrt::Windows::Foundation::Uri mediaUri(L"C:\\Windows\\SystemResources\\Windows.UI.SettingsAppThreshold\\SystemSettings\\Assets\\SDRSample.mkv");
20 | MediaPlayer().Source(winrt::Windows::Media::Core::MediaSource::CreateFromUri(mediaUri));
21 | inkToolbar().TargetInkCanvas(inkCanvasDemo());
22 |
23 | winrt::MileXamlControlsDemo::TreeViewItemModel rootNode1 = winrt::make();
24 | rootNode1.Name(L"TreeView Root Node 1");
25 | rootNode1.IsSelected(true);
26 | _treeViewDataList.Append(rootNode1);
27 |
28 | winrt::MileXamlControlsDemo::TreeViewItemModel childNode1 = winrt::make();
29 | childNode1.Name(L"TreeView child Node 1");
30 | childNode1.IsSelected(false);
31 | rootNode1.ChildrenNode().Append(childNode1);
32 |
33 | winrt::MileXamlControlsDemo::TreeViewItemModel childNode2 = winrt::make();
34 | childNode2.Name(L"TreeView child Node 2");
35 | childNode2.IsSelected(false);
36 | rootNode1.ChildrenNode().Append(childNode2);
37 |
38 | winrt::MileXamlControlsDemo::TreeViewItemModel childNode3 = winrt::make();
39 | childNode3.Name(L"TreeView child Node 3");
40 | childNode3.IsSelected(false);
41 | rootNode1.ChildrenNode().Append(childNode3);
42 |
43 | winrt::MileXamlControlsDemo::TreeViewItemModel rootNode2 = winrt::make();
44 | rootNode2.Name(L"TreeView Root Node 2");
45 | rootNode2.IsSelected(false);
46 | _treeViewDataList.Append(rootNode2);
47 |
48 | winrt::MileXamlControlsDemo::TreeViewItemModel childNode4 = winrt::make();
49 | childNode4.Name(L"TreeView child Node 4");
50 | childNode4.IsSelected(false);
51 | rootNode2.ChildrenNode().Append(childNode4);
52 |
53 | winrt::MileXamlControlsDemo::TreeViewItemModel childNode5 = winrt::make();
54 | childNode5.Name(L"TreeView child Node 5");
55 | childNode5.IsSelected(false);
56 | rootNode2.ChildrenNode().Append(childNode5);
57 | }
58 |
59 | void MainPage::HyperlinkButton_Click(Windows::Foundation::IInspectable const& /* sender */, Windows::UI::Xaml::RoutedEventArgs const& /* args */)
60 | {
61 | winrt::Windows::Foundation::Uri vp9LinkUri(L"ms-windows-store://pdp/?productid=9N4D0MSMP0PT");
62 | winrt::Windows::System::Launcher::LaunchUriAsync(vp9LinkUri);
63 | }
64 |
65 | void MainPage::HyperlinkButton_Click1(Windows::Foundation::IInspectable const& /* sender */, Windows::UI::Xaml::RoutedEventArgs const& /* args */)
66 | {
67 | winrt::Windows::Foundation::Uri vp9LinkUri(L"https://learn.microsoft.com/en-us/answers/questions/635070/(ver-10-0-19041-0)-c-winrt-treeview-nodes-not-prop?childtoview=635698");
68 | winrt::Windows::System::Launcher::LaunchUriAsync(vp9LinkUri);
69 | }
70 |
71 | winrt::Windows::Foundation::Collections::IObservableVector MainPage::TreeViewDataList()
72 | {
73 | return _treeViewDataList;
74 | }
75 |
76 | void MainPage::TreeViewDataList(winrt::Windows::Foundation::Collections::IObservableVector value)
77 | {
78 | _treeViewDataList = value;
79 | }
80 | }
81 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/MainPage.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "MainPage.g.h"
4 |
5 | #include "winrt/Windows.Foundation.Collections.h"
6 |
7 | namespace winrt::MileXamlControlsDemo::implementation
8 | {
9 | struct MainPage : MainPageT
10 | {
11 | public:
12 | MainPage() = default;
13 |
14 | void InitializeComponent();
15 |
16 | int32_t MyProperty();
17 | void MyProperty(int32_t value);
18 |
19 | void ClickHandler(Windows::Foundation::IInspectable const& sender, Windows::UI::Xaml::RoutedEventArgs const& args);
20 | void HyperlinkButton_Click(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::RoutedEventArgs const&);
21 | void HyperlinkButton_Click1(winrt::Windows::Foundation::IInspectable const&, winrt::Windows::UI::Xaml::RoutedEventArgs const&);
22 |
23 | winrt::Windows::Foundation::Collections::IObservableVector TreeViewDataList();
24 | void TreeViewDataList(winrt::Windows::Foundation::Collections::IObservableVector value);
25 |
26 | private:
27 | winrt::Windows::Foundation::Collections::IObservableVector _treeViewDataList = winrt::single_threaded_observable_vector();
28 |
29 | };
30 | }
31 |
32 | namespace winrt::MileXamlControlsDemo::factory_implementation
33 | {
34 | struct MainPage : MainPageT
35 | {
36 | };
37 | }
38 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/MainPage.idl:
--------------------------------------------------------------------------------
1 | import "TreeViewItemModel.idl";
2 |
3 | namespace MileXamlControlsDemo
4 | {
5 | [default_interface]
6 | runtimeclass MainPage : Windows.UI.Xaml.Controls.Page
7 | {
8 | MainPage();
9 |
10 | void HyperlinkButton_Click(Object sender, Windows.UI.Xaml.RoutedEventArgs args);
11 | void HyperlinkButton_Click1(Object sender, Windows.UI.Xaml.RoutedEventArgs args);
12 |
13 | Windows.Foundation.Collections.IObservableVector TreeViewDataList { get; set; };
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/MileXamlControlsDemo.manifest:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
12 |
13 |
14 |
15 |
16 | PerMonitorV2, PerMonitor, System, Unaware
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
28 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/MileXamlControlsDemo.vcxproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | {5674D8DF-3C1E-4D7B-8382-E4FBAE12AAA5}
5 | MileXamlControlsDemo
6 | MileXamlControlsDemo
7 | WindowsApplication
8 | MileXamlControlsDemo.manifest
9 | false
10 | en-US
11 | 15.0
12 | false
13 | false
14 | Windows Store
15 | 10.0
16 | 10.0.19041.0
17 | true
18 | true
19 | true
20 | Project Mile
21 | Mile.Xaml Controls Demo Sample
22 | MileXamlControlsDemo
23 | © Project Mile. All rights reserved.
24 | MileXamlControlsDemo.exe
25 | Mile.Xaml
26 | 1.0.0.0
27 | Alpha 1
28 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 | $(MileProjectBinariesPath)$(Configuration)\$(Platform)\$(ProjectName)\
39 |
40 |
41 |
42 | runtimeobject.lib;%(AdditionalDependencies)
43 |
44 |
45 |
46 |
47 |
48 | App.xaml
49 |
50 |
51 | MainPage.xaml
52 |
53 |
54 | TreeViewItemModel.idl
55 | Code
56 |
57 |
58 |
59 |
60 | Designer
61 |
62 |
63 | Designer
64 |
65 |
66 |
67 |
68 | Create
69 |
70 |
71 | App.xaml
72 |
73 |
74 | MainPage.xaml
75 |
76 |
77 |
78 | TreeViewItemModel.idl
79 | Code
80 |
81 |
82 |
83 |
84 |
85 | App.xaml
86 |
87 |
88 | MainPage.xaml
89 |
90 |
91 | Designer
92 |
93 |
94 |
95 |
96 |
97 |
98 |
99 |
100 |
101 |
102 | 2.5.1250
103 |
104 |
105 |
106 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/PropertySheet.props:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
14 |
15 |
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/TreeViewItemModel.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 | #include "TreeViewItemModel.h"
3 | #if __has_include("TreeViewItemModel.g.cpp")
4 | #include "TreeViewItemModel.g.cpp"
5 | #endif
6 |
7 | namespace winrt::MileXamlControlsDemo::implementation
8 | {
9 | bool TreeViewItemModel::IsSelected()
10 | {
11 | return _isSelected;
12 | }
13 |
14 | void TreeViewItemModel::IsSelected(bool value)
15 | {
16 | _isSelected = value;
17 | }
18 |
19 | winrt::hstring TreeViewItemModel::Name()
20 | {
21 | return _name;
22 | }
23 |
24 | void TreeViewItemModel::Name(winrt::hstring value)
25 | {
26 | _name = value;
27 | }
28 |
29 | winrt::Windows::Foundation::Collections::IObservableVector TreeViewItemModel::ChildrenNode()
30 | {
31 | return _childrenNode;
32 | }
33 |
34 | void TreeViewItemModel::ChildrenNode(winrt::Windows::Foundation::Collections::IObservableVector value)
35 | {
36 | _childrenNode = value;
37 | }
38 | }
39 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/TreeViewItemModel.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 |
3 | #include "TreeViewItemModel.g.h"
4 |
5 | #include "winrt/Windows.Foundation.Collections.h"
6 |
7 | namespace winrt::MileXamlControlsDemo::implementation
8 | {
9 | struct TreeViewItemModel : TreeViewItemModelT
10 | {
11 | public:
12 | TreeViewItemModel() = default;
13 |
14 | bool IsSelected();
15 | void IsSelected(bool value);
16 |
17 | winrt::hstring Name();
18 | void Name(winrt::hstring value);
19 |
20 | winrt::Windows::Foundation::Collections::IObservableVector ChildrenNode();
21 | void ChildrenNode(winrt::Windows::Foundation::Collections::IObservableVector value);
22 |
23 | private:
24 | bool _isSelected = false;
25 | winrt::hstring _name = L"";
26 | winrt::Windows::Foundation::Collections::IObservableVector _childrenNode = winrt::single_threaded_observable_vector();
27 | };
28 | }
29 |
30 | namespace winrt::MileXamlControlsDemo::factory_implementation
31 | {
32 | struct TreeViewItemModel : TreeViewItemModelT
33 | {
34 | };
35 | }
36 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/TreeViewItemModel.idl:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemo
2 | {
3 | [bindable]
4 | [default_interface]
5 | runtimeclass TreeViewItemModel
6 | {
7 | TreeViewItemModel();
8 |
9 | Boolean IsSelected{ get; set; };
10 |
11 | String Name{ get; set; };
12 |
13 | Windows.Foundation.Collections.IObservableVector ChildrenNode { get; set; };
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/WinMain.cpp:
--------------------------------------------------------------------------------
1 | #include
2 |
3 | #include "pch.h"
4 |
5 | #include "App.h"
6 | #include "MainPage.h"
7 |
8 | int WINAPI wWinMain(
9 | _In_ HINSTANCE hInstance,
10 | _In_opt_ HINSTANCE hPrevInstance,
11 | _In_ LPWSTR lpCmdLine,
12 | _In_ int nShowCmd)
13 | {
14 | UNREFERENCED_PARAMETER(hPrevInstance);
15 | UNREFERENCED_PARAMETER(lpCmdLine);
16 |
17 | winrt::init_apartment(winrt::apartment_type::single_threaded);
18 |
19 | winrt::com_ptr app =
20 | winrt::make_self();
21 |
22 | winrt::MileXamlControlsDemo::MainPage XamlWindowContent =
23 | winrt::make();
24 |
25 | HWND WindowHandle = ::CreateWindowExW(
26 | WS_EX_CLIENTEDGE,
27 | L"Mile.Xaml.ContentWindow",
28 | L"MileXamlControlsDemo",
29 | WS_OVERLAPPEDWINDOW,
30 | CW_USEDEFAULT,
31 | 0,
32 | CW_USEDEFAULT,
33 | 0,
34 | nullptr,
35 | nullptr,
36 | hInstance,
37 | winrt::get_abi(XamlWindowContent));
38 | if (!WindowHandle)
39 | {
40 | return -1;
41 | }
42 |
43 | ::ShowWindow(WindowHandle, nShowCmd);
44 | ::UpdateWindow(WindowHandle);
45 |
46 | MSG Message;
47 | while (::GetMessageW(&Message, nullptr, 0, 0))
48 | {
49 | // Workaround for capturing Alt+F4 in applications with XAML Islands.
50 | // Reference: https://github.com/microsoft/microsoft-ui-xaml/issues/2408
51 | if (Message.message == WM_SYSKEYDOWN && Message.wParam == VK_F4)
52 | {
53 | ::SendMessageW(
54 | ::GetAncestor(Message.hwnd, GA_ROOT),
55 | Message.message,
56 | Message.wParam,
57 | Message.lParam);
58 |
59 | continue;
60 | }
61 |
62 | ::TranslateMessage(&Message);
63 | ::DispatchMessageW(&Message);
64 | }
65 |
66 | app->Close();
67 |
68 | return static_cast(Message.wParam);
69 | }
70 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/pch.cpp:
--------------------------------------------------------------------------------
1 | #include "pch.h"
2 |
--------------------------------------------------------------------------------
/MileXamlControlsDemo/pch.h:
--------------------------------------------------------------------------------
1 | #pragma once
2 | #include
3 |
4 | // https://github.com/microsoft/terminal
5 | // /blob/c727762602b8bd12e4a3a769053204d7e92b81c5
6 | // /src/cascadia/WindowsTerminalUniversal/pch.h#L12
7 | // This is inexplicable, but for whatever reason, cppwinrt conflicts with the
8 | // SDK definition of this function, so the only fix is to undef it.
9 | // from WinBase.h
10 | // Windows::UI::Xaml::Media::Animation::IStoryboard::GetCurrentTime
11 | #ifdef GetCurrentTime
12 | #undef GetCurrentTime
13 | #endif
14 |
15 | #include
16 | #include
17 | #include
18 | #include
19 | #include
20 | #include
21 | #include
22 | #include
23 | #include
24 | #include
25 | #include
26 | #include
27 | #include
28 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/App.manifest:
--------------------------------------------------------------------------------
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 | False
26 | False
27 | True/PM
28 | True
29 | True
30 | True
31 | True
32 | False
33 | PerMonitorV2, PerMonitor, System, Unaware
34 | True
35 | False
36 | UTF-8
37 | SegmentHeap
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/App.xaml:
--------------------------------------------------------------------------------
1 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using Windows.UI.Xaml;
3 |
4 | namespace MileXamlControlsDemoNetCore
5 | {
6 | sealed partial class App : Application
7 | {
8 | public App()
9 | {
10 | this.ThreadInitialize();
11 | this.InitializeComponent();
12 | }
13 |
14 | public void Close()
15 | {
16 | this.Exit();
17 | this.ThreadUninitialize();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | SuspendLayout();
32 | //
33 | // Form1
34 | //
35 | AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F);
36 | AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | ClientSize = new System.Drawing.Size(1500, 800);
38 | Name = "Form1";
39 | Text = "MileXamlControlsDemo (Modern .Net)";
40 | ResumeLayout(false);
41 | }
42 |
43 | #endregion
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Form1.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using System;
3 | using System.Windows.Forms;
4 |
5 | namespace MileXamlControlsDemoNetCore
6 | {
7 | public partial class Form1 : Form
8 | {
9 | WindowsXamlHost xamlHost = new WindowsXamlHost();
10 |
11 | public Form1()
12 | {
13 | InitializeComponent();
14 |
15 |
16 | this.Controls.Add(xamlHost);
17 | xamlHost.AutoSize = true;
18 | xamlHost.Dock = DockStyle.Fill;
19 | xamlHost.Child = new MainPage();
20 |
21 | this.Load += Form1_Load;
22 | }
23 |
24 | private void Form1_Load(object sender, EventArgs e)
25 | {
26 |
27 | }
28 | }
29 | }
30 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Helpers/BackdropHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Windows.Forms;
4 | using Windows.System;
5 | using Windows.UI.Composition.Desktop;
6 | using Windows.UI.Xaml;
7 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
8 | using MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.Combase;
9 | using System.Runtime.InteropServices.Marshalling;
10 |
11 | namespace MileXamlControlsDemoNetCore.Backdrop
12 | {
13 | public static class BackdropHelper
14 | {
15 | private static readonly StrategyBasedComWrappers strategyBasedComWrappers = new();
16 |
17 | public static Lazy PropertyValueStatics { get; } = new(() => GetActivationFactory("Windows.Foundation.PropertyValue", typeof(IPropertyValueStatics).GUID));
18 |
19 | public static T GetActivationFactory(string activatableClassId, Guid iid)
20 | {
21 | if (!string.IsNullOrEmpty(activatableClassId))
22 | {
23 | Marshal.ThrowExceptionForHR(CombaseLibrary.WindowsCreateString(activatableClassId, activatableClassId.Length, out IntPtr stringPtr));
24 | Marshal.ThrowExceptionForHR(CombaseLibrary.RoGetActivationFactory(stringPtr, iid, out IntPtr comp));
25 | Marshal.ThrowExceptionForHR(CombaseLibrary.WindowsDeleteString(stringPtr));
26 | return (T)strategyBasedComWrappers.GetOrCreateObjectForComInstance(comp, CreateObjectFlags.None);
27 | }
28 | else
29 | {
30 | return default;
31 | }
32 | }
33 |
34 | public static DesktopWindowTarget InitializeDesktopWindowTarget(Form form, bool isTopMost)
35 | {
36 | if (form.Handle == IntPtr.Zero)
37 | {
38 | throw new NullReferenceException("Form window not initialized");
39 | }
40 |
41 | IntPtr desktopWindowTargetPtr = IntPtr.Zero;
42 | if (DispatcherQueue.GetForCurrentThread() is not null)
43 | {
44 | ICompositorDesktopInterop interop = Window.Current.Compositor as object as ICompositorDesktopInterop;
45 | interop.CreateDesktopWindowTarget(form.Handle, isTopMost, out desktopWindowTargetPtr);
46 | }
47 |
48 | return desktopWindowTargetPtr != IntPtr.Zero ? DesktopWindowTarget.FromAbi(desktopWindowTargetPtr) : null;
49 | }
50 | }
51 | }
52 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/MileXamlControlsDemoNetCore.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net9.0-windows10.0.26100.0
6 | 10.0.26100.0
7 | 10.0.19041.0
8 | latest
9 | App.manifest
10 | true
11 | true
12 | win-x86;win-x64;win-arm64
13 | resources.pri
14 | <_SuppressWinFormsTrimError>true
15 | true
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 |
25 | Form
26 |
27 |
28 |
29 |
30 |
31 | Always
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 | $(ProjectPriFileName)
40 | PreserveNewest
41 |
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace MileXamlControlsDemoNetCore
5 | {
6 | public static class Program
7 | {
8 | public static Form MainForm { get; private set; }
9 |
10 | [STAThread]
11 | private static void Main()
12 | {
13 | Application.EnableVisualStyles();
14 | Application.SetCompatibleTextRenderingDefault(false);
15 |
16 | App app = new();
17 |
18 | MainForm = new Form1();
19 | Application.Run(MainForm);
20 |
21 | app.Close();
22 | }
23 | }
24 | }
25 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Properties/PublishProfiles/win-arm64.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | ARM64
9 | win-arm64
10 | net9.0-windows10.0.26100.0
11 | ..\Output\Binaries\$(Configuration)\$(TargetFramework)\publish\$(RuntimeIdentifier)\
12 | FileSystem
13 | <_TargetId>Folder
14 | true
15 |
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Properties/PublishProfiles/win-x64.pubxml:
--------------------------------------------------------------------------------
1 |
2 |
5 |
6 |
7 | Release
8 | x64
9 | win-x64
10 | net9.0-windows10.0.26100.0
11 | ..\Output\Binaries\$(Configuration)\$(TargetFramework)\publish\$(RuntimeIdentifier)\
12 | FileSystem
13 | <_TargetId>Folder
14 | true
15 |
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Properties/launchSettings.json:
--------------------------------------------------------------------------------
1 | {
2 | "profiles": {
3 | "MileXamlControlsDemoNetCore": {
4 | "commandName": "Project",
5 | "nativeDebugging": false
6 | }
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/Resources/NoiseAsset_256x256_PNG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlControlsDemoNetCore/Resources/NoiseAsset_256x256_PNG.png
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/TreeViewItemModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace MileXamlControlsDemoNetCore
9 | {
10 | public class TreeViewItemModel
11 | {
12 | public bool IsSelected { get; set; }
13 | public string Name { get; set; }
14 | public ObservableCollection ChildrenNode { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/BlendEffect.cs:
--------------------------------------------------------------------------------
1 | using MileXamlControlsDemoNetCore.Backdrop;
2 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
3 | using System;
4 | using System.Diagnostics;
5 | using System.Runtime.InteropServices;
6 | using Windows.Graphics.Effects;
7 |
8 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
9 | {
10 | [Guid("81C5B77B-13F8-4CDD-AD20-C890547AC65D")]
11 | public sealed partial class BlendEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
12 | {
13 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
14 |
15 | public bool CacheOutput { get; set; }
16 |
17 | public BlendEffectMode Mode { get; set; } = BlendEffectMode.Multiply;
18 |
19 | public IGraphicsEffectSource Background { get; set; }
20 |
21 | public IGraphicsEffectSource Foreground { get; set; }
22 |
23 | private string _name = string.Empty;
24 |
25 | public string Name
26 | {
27 | get { return _name; }
28 |
29 | set { _name = value; }
30 | }
31 |
32 | public int GetEffectId(out Guid id)
33 | {
34 | id = typeof(BlendEffect).GUID;
35 | return 0;
36 | }
37 |
38 | public int GetNamedPropertyMapping(IntPtr name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
39 | {
40 | switch (Marshal.PtrToStringUni(name))
41 | {
42 | case nameof(Mode):
43 | {
44 | index = 0;
45 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
46 | break;
47 | }
48 | default:
49 | {
50 | index = 0xFF;
51 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
52 | break;
53 | }
54 | }
55 | return 0;
56 | }
57 |
58 | public int GetProperty(uint index, out IntPtr source)
59 | {
60 | if (index is 0)
61 | {
62 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)Mode, out IntPtr ptr);
63 | if (ptr != IntPtr.Zero)
64 | {
65 | source = ptr;
66 | return 0;
67 | }
68 | }
69 | source = IntPtr.Zero;
70 | return -2147483637;
71 | }
72 |
73 | public int GetPropertyCount(out uint count)
74 | {
75 | count = 1;
76 | return 0;
77 | }
78 |
79 | public int GetSource(uint index, out IGraphicsEffectSource source)
80 | {
81 | if (index is 0)
82 | {
83 | source = Background;
84 | return 0;
85 | }
86 | else if (index is 1)
87 | {
88 | source = Foreground;
89 | return 0;
90 | }
91 | else
92 | {
93 | source = null;
94 | return 2147483637;
95 | }
96 | }
97 |
98 | public int GetSourceCount(out uint count)
99 | {
100 | count = 2;
101 | return 0;
102 | }
103 | }
104 | }
105 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/BlendEffectMode.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
2 | {
3 | public enum BlendEffectMode
4 | {
5 | Multiply = 0,
6 | Screen = 1,
7 | Darken = 2,
8 | Lighten = 3,
9 | Dissolve = 4,
10 | ColorBurn = 5,
11 | LinearBurn = 6,
12 | DarkerColor = 7,
13 | LighterColor = 8,
14 | ColorDodge = 9,
15 | LinearDodge = 10,
16 | Overlay = 11,
17 | SoftLight = 12,
18 | HardLight = 13,
19 | VividLight = 14,
20 | LinearLight = 15,
21 | PinLight = 16,
22 | HardMix = 17,
23 | Difference = 18,
24 | Exclusion = 19,
25 | Hue = 20,
26 | Saturation = 21,
27 | Color = 22,
28 | Luminosity = 23,
29 | Subtract = 24,
30 | Division = 25
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/BorderEffect.cs:
--------------------------------------------------------------------------------
1 | using MileXamlControlsDemoNetCore.Backdrop;
2 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
3 | using System;
4 | using System.Diagnostics;
5 | using System.Runtime.InteropServices;
6 | using Windows.Graphics.Effects;
7 |
8 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
9 | {
10 | [Guid("2A2D49C0-4ACF-43C7-8C6A-7C4A27874D27")]
11 | public partial class BorderEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
12 | {
13 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
14 |
15 | public bool CacheOutput { get; set; }
16 |
17 | public CanvasEdgeBehavior ExtendX { get; set; } = CanvasEdgeBehavior.Clamp;
18 |
19 | public CanvasEdgeBehavior ExtendY { get; set; } = CanvasEdgeBehavior.Clamp;
20 |
21 | public IGraphicsEffectSource Source { get; set; }
22 |
23 | private string _name = string.Empty;
24 |
25 | public string Name
26 | {
27 | get { return _name; }
28 |
29 | set { _name = value; }
30 | }
31 |
32 | public int GetEffectId(out Guid id)
33 | {
34 | id = typeof(BorderEffect).GUID;
35 | return 0;
36 | }
37 |
38 | public int GetNamedPropertyMapping(IntPtr name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
39 | {
40 | switch (Marshal.PtrToStringUni(name))
41 | {
42 | case nameof(ExtendX):
43 | {
44 | index = 0;
45 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
46 | break;
47 | }
48 | case nameof(ExtendY):
49 | {
50 | index = 1;
51 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
52 | break;
53 | }
54 | default:
55 | {
56 | index = 0xFF;
57 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
58 | break;
59 | }
60 | }
61 | return 0;
62 | }
63 |
64 | public int GetProperty(uint index, out IntPtr source)
65 | {
66 | if (index is 0)
67 | {
68 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)ExtendX, out IntPtr ptr);
69 |
70 | if (ptr != IntPtr.Zero)
71 | {
72 | source = ptr;
73 | return 0;
74 | }
75 | }
76 | else if (index is 1)
77 | {
78 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)ExtendY, out IntPtr ptr);
79 |
80 | if (ptr != IntPtr.Zero)
81 | {
82 | source = ptr;
83 | return 0;
84 | }
85 | }
86 | source = IntPtr.Zero;
87 | return -2147483637;
88 | }
89 |
90 | public int GetPropertyCount(out uint count)
91 | {
92 | count = 2;
93 | return 0;
94 | }
95 |
96 | public int GetSource(uint index, out IGraphicsEffectSource source)
97 | {
98 | if (index is 0)
99 | {
100 | source = Source;
101 | return 0;
102 | }
103 | else
104 | {
105 | source = null;
106 | return 2147483637;
107 | }
108 | }
109 |
110 | public int GetSourceCount(out uint count)
111 | {
112 | count = 1;
113 | return 0;
114 | }
115 | }
116 | }
117 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/CanvasComposite.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
2 | {
3 | public enum CanvasComposite
4 | {
5 | SourceOver = 0,
6 | DestinationOver = 1,
7 | SourceIn = 2,
8 | DestinationIn = 3,
9 | SourceOut = 4,
10 | DestinationOut = 5,
11 | SourceAtop = 6,
12 | DestinationAtop = 7,
13 | Xor = 8,
14 | Add = 9,
15 | Copy = 10,
16 | BoundedCopy = 11,
17 | MaskInvert = 12
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/CanvasEdgeBehavior.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
2 | {
3 | public enum CanvasEdgeBehavior
4 | {
5 | Clamp = 0,
6 | Wrap = 1,
7 | Mirror = 2
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/ColorSourceEffect.cs:
--------------------------------------------------------------------------------
1 | using MileXamlControlsDemoNetCore.Backdrop;
2 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
3 | using System;
4 | using System.Diagnostics;
5 | using System.Numerics;
6 | using System.Runtime.InteropServices;
7 | using Windows.Graphics.Effects;
8 | using Windows.UI;
9 |
10 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
11 | {
12 | [Guid("61C23C20-AE69-4D8E-94CF-50078DF638F2")]
13 | public sealed partial class ColorSourceEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
14 | {
15 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
16 |
17 | public bool CacheOutput { get; set; }
18 |
19 | public Color Color { get; set; } = Color.FromArgb(255, 255, 255, 255);
20 |
21 | private string _name = string.Empty;
22 |
23 | public string Name
24 | {
25 | get { return _name; }
26 |
27 | set { _name = value; }
28 | }
29 |
30 | public Vector4 ColorHdr
31 | {
32 | get { return new(Color.R * 255.0f, Color.G * 255.0f, Color.B * 255.0f, Color.A * 255.0f); }
33 |
34 | set { Color = Color.FromArgb((byte)(value.W / 255.0f), (byte)(value.X / 255.0f), (byte)(value.Y / 255.0f), (byte)(value.Z / 255.0f)); }
35 | }
36 |
37 | public int GetEffectId(out Guid id)
38 | {
39 | id = typeof(ColorSourceEffect).GUID;
40 | return 0;
41 | }
42 |
43 | public int GetNamedPropertyMapping(IntPtr name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
44 | {
45 | switch (Marshal.PtrToStringUni(name))
46 | {
47 | case nameof(Color):
48 | {
49 | index = 0;
50 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4;
51 | break;
52 | }
53 | default:
54 | {
55 | index = 0xFF;
56 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
57 | break;
58 | }
59 | }
60 |
61 | return 0;
62 | }
63 |
64 | public int GetProperty(uint index, out IntPtr source)
65 | {
66 | if (index is 0)
67 | {
68 | BackdropHelper.PropertyValueStatics.Value.CreateSingleArray(4, [Color.R / 255.0f, Color.G / 255.0f, Color.B / 255.0f, Color.A / 255.0f], out IntPtr ptr);
69 | if (ptr != IntPtr.Zero)
70 | {
71 | source = ptr;
72 | return 0;
73 | }
74 | }
75 |
76 | source = IntPtr.Zero;
77 | return -2147483637;
78 | }
79 |
80 | public int GetPropertyCount(out uint count)
81 | {
82 | count = 1;
83 | return 0;
84 | }
85 |
86 | public int GetSource(uint index, out IGraphicsEffectSource source)
87 | {
88 | source = default;
89 | return 0;
90 | }
91 |
92 | public int GetSourceCount(out uint count)
93 | {
94 | count = 0;
95 | return 0;
96 | }
97 | }
98 | }
99 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/CompositeEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.InteropServices;
4 | using Windows.Graphics.Effects;
5 | using MileXamlControlsDemoNetCore.Backdrop;
6 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
7 | using System.Diagnostics;
8 |
9 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
10 | {
11 | [Guid("48FC9F51-F6AC-48F1-8B58-3B28AC46F76D")]
12 | public partial class CompositeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
13 | {
14 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
15 |
16 | public bool CacheOutput { get; set; }
17 |
18 | public CanvasComposite Mode { get; set; } = CanvasComposite.SourceOver;
19 |
20 | private string _name = string.Empty;
21 |
22 | public string Name
23 | {
24 | get { return _name; }
25 |
26 | set { _name = value; }
27 | }
28 |
29 | public List Sources { get; set; } = [];
30 |
31 | public int GetEffectId(out Guid id)
32 | {
33 | id = typeof(CompositeEffect).GUID;
34 | return 0;
35 | }
36 |
37 | public int GetNamedPropertyMapping(IntPtr name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
38 | {
39 | switch (Marshal.PtrToStringUni(name))
40 | {
41 | case nameof(Mode):
42 | {
43 | index = 0;
44 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
45 | break;
46 | }
47 | default:
48 | {
49 | index = 0xFF;
50 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
51 | break;
52 | }
53 | }
54 |
55 | return 0;
56 | }
57 |
58 | public int GetProperty(uint index, out IntPtr source)
59 | {
60 | if (index is 0)
61 | {
62 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)Mode, out IntPtr ptr);
63 |
64 | if (ptr != IntPtr.Zero)
65 | {
66 | source = ptr;
67 | return 0;
68 | }
69 | }
70 |
71 | source = IntPtr.Zero;
72 | return -2147483637;
73 | }
74 |
75 | public int GetPropertyCount(out uint count)
76 | {
77 | count = 1;
78 | return 0;
79 | }
80 |
81 | public int GetSource(uint index, out IGraphicsEffectSource source)
82 | {
83 | if (index < Sources.Count)
84 | {
85 | source = Sources[(int)index];
86 | return 0;
87 | }
88 | else
89 | {
90 | source = null;
91 | return 2147483637;
92 | }
93 | }
94 |
95 | public int GetSourceCount(out uint count)
96 | {
97 | count = (uint)Sources.Count;
98 | return 0;
99 | }
100 | }
101 | }
102 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/CrossFadeEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Graphics.Effects;
4 | using MileXamlControlsDemoNetCore.Backdrop;
5 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
6 | using System.Diagnostics;
7 |
8 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
9 | {
10 | [Guid("12F575E8-4DB1-485F-9A84-03A07DD3829F")]
11 | public sealed partial class CrossFadeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
12 | {
13 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
14 |
15 | public bool CacheOutput { get; set; }
16 |
17 | public float CrossFade { get; set; } = 0.5f;
18 |
19 | public IGraphicsEffectSource Source1 { get; set; }
20 |
21 | public IGraphicsEffectSource Source2 { get; set; }
22 |
23 | private string _name = string.Empty;
24 |
25 | public string Name
26 | {
27 | get { return _name; }
28 |
29 | set { _name = value; }
30 | }
31 |
32 | public int GetEffectId(out Guid id)
33 | {
34 | id = typeof(CrossFadeEffect).GUID;
35 | return 0;
36 | }
37 |
38 | public int GetNamedPropertyMapping(IntPtr name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
39 | {
40 | switch (Marshal.PtrToStringUni(name))
41 | {
42 | case nameof(CrossFade):
43 | {
44 | index = 0;
45 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
46 | break;
47 | }
48 | default:
49 | {
50 | index = 0xFF;
51 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
52 | break;
53 | }
54 | }
55 |
56 | return 0;
57 | }
58 |
59 | public int GetProperty(uint index, out IntPtr source)
60 | {
61 | if (index is 0)
62 | {
63 | BackdropHelper.PropertyValueStatics.Value.CreateSingle((float)CrossFade, out IntPtr ptr);
64 | if (ptr != IntPtr.Zero)
65 | {
66 | source = ptr;
67 | return 0;
68 | }
69 | }
70 |
71 | source = IntPtr.Zero;
72 | return -2147483637;
73 | }
74 |
75 | public int GetPropertyCount(out uint count)
76 | {
77 | count = 1;
78 | return 0;
79 | }
80 |
81 | public int GetSource(uint index, out IGraphicsEffectSource source)
82 | {
83 | if (index is 0)
84 | {
85 | source = Source1;
86 | return 0;
87 | }
88 | else if (index is 1)
89 | {
90 | source = Source2;
91 | return 0;
92 | }
93 | else
94 | {
95 | source = null;
96 | return 2147483637;
97 | }
98 | }
99 |
100 | public int GetSourceCount(out uint count)
101 | {
102 | count = 2;
103 | return 0;
104 | }
105 | }
106 | }
107 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/DesktopAcrylicKind.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
2 | {
3 | public enum DesktopAcrylicKind
4 | {
5 | Default = 0,
6 |
7 | Base = 1,
8 |
9 | Thin = 2
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/EffectBorderMode.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
2 | {
3 | public enum EffectBorderMode
4 | {
5 | Soft = 0,
6 | Hard = 1
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/EffectOptimization.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
2 | {
3 | public enum EffectOptimization
4 | {
5 | Speed = 0,
6 | Balanced = 1,
7 | Quality = 2
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/GaussianBlurEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Graphics.Effects;
4 | using MileXamlControlsDemoNetCore.Backdrop;
5 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
6 | using System.Diagnostics;
7 |
8 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
9 | {
10 | [Guid("1FEB6D69-2FE6-4AC9-8C58-1D7F93E7A6A5")]
11 | public partial class GaussianBlurEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
12 | {
13 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
14 |
15 | public bool CacheOutput { get; set; }
16 |
17 | public IGraphicsEffectSource Source { get; set; }
18 |
19 | public float BlurAmount { get; set; } = 3.0f;
20 |
21 | public EffectOptimization Optimization { get; set; } = EffectOptimization.Balanced;
22 |
23 | public EffectBorderMode BorderMode { get; set; } = EffectBorderMode.Soft;
24 |
25 | private string _name = string.Empty;
26 |
27 | public string Name
28 | {
29 | get { return _name; }
30 |
31 | set { _name = value; }
32 | }
33 |
34 | public int GetEffectId(out Guid id)
35 | {
36 | id = typeof(GaussianBlurEffect).GUID;
37 | return 0;
38 | }
39 |
40 | public int GetNamedPropertyMapping(IntPtr name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
41 | {
42 | switch (Marshal.PtrToStringUni(name))
43 | {
44 | case nameof(BlurAmount):
45 | {
46 | index = 0;
47 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
48 | break;
49 | }
50 | case nameof(Optimization):
51 | {
52 | index = 1;
53 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
54 | break;
55 | }
56 | case nameof(BorderMode):
57 | {
58 | index = 2;
59 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
60 | break;
61 | }
62 | default:
63 | {
64 | index = 0xFF;
65 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
66 | break;
67 | }
68 | }
69 |
70 | return 0;
71 | }
72 |
73 | public int GetProperty(uint index, out IntPtr source)
74 | {
75 | if (index is 0)
76 | {
77 | BackdropHelper.PropertyValueStatics.Value.CreateSingle(BlurAmount, out IntPtr ptr);
78 |
79 | if (ptr != IntPtr.Zero)
80 | {
81 | source = ptr;
82 | return 0;
83 | }
84 | }
85 | else if (index is 1)
86 | {
87 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)Optimization, out IntPtr ptr);
88 |
89 | if (ptr != IntPtr.Zero)
90 | {
91 | source = ptr;
92 | return 0;
93 | }
94 | }
95 | else if (index is 2)
96 | {
97 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)BorderMode, out IntPtr ptr);
98 |
99 | if (ptr != IntPtr.Zero)
100 | {
101 | source = ptr;
102 | return 0;
103 | }
104 | }
105 |
106 | source = IntPtr.Zero;
107 | return -2147483637;
108 | }
109 |
110 | public int GetPropertyCount(out uint count)
111 | {
112 | count = 3;
113 | return 0;
114 | }
115 |
116 | public int GetSource(uint index, out IGraphicsEffectSource source)
117 | {
118 | if (index is 0)
119 | {
120 | source = Source;
121 | return 0;
122 | }
123 | else
124 | {
125 | source = null;
126 | return 2147483637;
127 | }
128 | }
129 |
130 | public int GetSourceCount(out uint count)
131 | {
132 | count = 1;
133 | return 0;
134 | }
135 | }
136 | }
137 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/MicaKind.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
2 | {
3 | public enum MicaKind
4 | {
5 | Base = 0,
6 |
7 | BaseAlt = 1
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/OpacityEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Graphics.Effects;
4 | using MileXamlControlsDemoNetCore.Backdrop;
5 | using MileXamlControlsDemoNetCore.WindowsAPI.ComTypes;
6 | using System.Diagnostics;
7 |
8 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
9 | {
10 | [Guid("811D79A4-DE28-4454-8094-C64685F8BD4C")]
11 | public sealed partial class OpacityEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
12 | {
13 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
14 |
15 | public bool CacheOutput { get; set; }
16 |
17 | public float Opacity { get; set; } = 1.0f;
18 |
19 | public IGraphicsEffectSource Source { get; set; }
20 |
21 | private string _name = string.Empty;
22 |
23 | public string Name
24 | {
25 | get { return _name; }
26 |
27 | set { _name = value; }
28 | }
29 |
30 | public int GetEffectId(out Guid id)
31 | {
32 | id = typeof(OpacityEffect).GUID;
33 | return 0;
34 | }
35 |
36 | public static bool IsSupported
37 | {
38 | get { return true; }
39 | }
40 |
41 | public int GetNamedPropertyMapping(IntPtr name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
42 | {
43 | switch (Marshal.PtrToStringUni(name))
44 | {
45 | case nameof(Opacity):
46 | {
47 | index = 0;
48 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
49 | break;
50 | }
51 | default:
52 | {
53 | index = 0xFF;
54 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
55 | break;
56 | }
57 | }
58 |
59 | return 0;
60 | }
61 |
62 | public int GetProperty(uint index, out IntPtr source)
63 | {
64 | if (index is 0)
65 | {
66 | BackdropHelper.PropertyValueStatics.Value.CreateSingle(Opacity, out IntPtr ptr);
67 | if (ptr != IntPtr.Zero)
68 | {
69 | source = ptr;
70 | return 0;
71 | }
72 | }
73 |
74 | source = IntPtr.Zero;
75 | return -2147483637;
76 | }
77 |
78 | public int GetPropertyCount(out uint count)
79 | {
80 | count = 1;
81 | return 0;
82 | }
83 |
84 | public int GetSource(uint index, out IGraphicsEffectSource source)
85 | {
86 | source = Source;
87 | return 0;
88 | }
89 |
90 | public int GetSourceCount(out uint count)
91 | {
92 | count = 1;
93 | return 0;
94 | }
95 | }
96 | }
97 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/UI/Backdrop/SystemBackdrop.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using Windows.UI;
4 | using Windows.UI.Composition.Desktop;
5 | using Windows.UI.Xaml;
6 |
7 | namespace MileXamlControlsDemoNetCore.UI.Backdrop
8 | {
9 | public abstract class SystemBackdrop(DesktopWindowTarget target) : IDisposable
10 | {
11 | public abstract float LightTintOpacity { get; set; }
12 |
13 | public abstract float LightLuminosityOpacity { get; set; }
14 |
15 | public abstract float DarkTintOpacity { get; set; }
16 |
17 | public abstract float DarkLuminosityOpacity { get; set; }
18 |
19 | public abstract Color LightTintColor { get; set; }
20 |
21 | public abstract Color LightFallbackColor { get; set; }
22 |
23 | public abstract Color DarkTintColor { get; set; }
24 |
25 | public abstract Color DarkFallbackColor { get; set; }
26 |
27 | public abstract ElementTheme RequestedTheme { get; set; }
28 |
29 | public abstract bool IsInputActive { get; set; }
30 |
31 | public DesktopWindowTarget DesktopWindowTarget { get; } = target;
32 |
33 | public abstract void InitializeBackdrop();
34 |
35 | public abstract void ResetProperties();
36 |
37 | public abstract void Dispose();
38 |
39 | protected bool IsAdvancedEffectsEnabled()
40 | {
41 | RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize");
42 | if (key is not null)
43 | {
44 | object value = key.GetValue("EnableTransparency");
45 | if (value is not null && Convert.ToInt32(value) is 1)
46 | {
47 | return true;
48 | }
49 | }
50 |
51 | return false;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/ComTypes/D2D1_BUFFER_PRECISION.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.WindowsAPI.ComTypes
2 | {
3 | public enum D2D1_BUFFER_PRECISION : uint
4 | {
5 | D2D1_BUFFER_PRECISION_UNKNOWN = 0,
6 | D2D1_BUFFER_PRECISION_8BPC_UNORM = 1,
7 | D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = 2,
8 | D2D1_BUFFER_PRECISION_16BPC_UNORM = 3,
9 | D2D1_BUFFER_PRECISION_16BPC_FLOAT = 4,
10 | D2D1_BUFFER_PRECISION_32BPC_FLOAT = 5,
11 | D2D1_BUFFER_PRECISION_FORCE_DWORD = 0xffffffff
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/ComTypes/GRAPHICS_EFFECT_PROPERTY_MAPPING.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetCore.WindowsAPI.ComTypes
2 | {
3 | public enum GRAPHICS_EFFECT_PROPERTY_MAPPING
4 | {
5 | GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN = 0,
6 |
7 | GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT = 1,
8 |
9 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX = 2,
10 |
11 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY = 3,
12 |
13 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ = 4,
14 |
15 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW = 5,
16 |
17 | GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4 = 6,
18 |
19 | GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES = 7,
20 |
21 | GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE = 8,
22 |
23 | GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3 = 9,
24 |
25 | GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 = 10
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/ComTypes/ICompositorDesktopInterop.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Runtime.InteropServices.Marshalling;
4 |
5 | namespace MileXamlControlsDemoNetCore.WindowsAPI.ComTypes
6 | {
7 | [GeneratedComInterface, Guid("29E691FA-4567-4DCA-B319-D0F207EB6807")]
8 | public partial interface ICompositorDesktopInterop
9 | {
10 | [PreserveSig]
11 | int CreateDesktopWindowTarget(IntPtr hwndTarget, [MarshalAs(UnmanagedType.VariantBool)] bool isTopmost, out IntPtr result);
12 |
13 | [PreserveSig]
14 | int EnsureOnThread(int threadId);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/PInvoke/Combase/CombaseLibrary.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.Combase
5 | {
6 | public static partial class CombaseLibrary
7 | {
8 | private const string Combase = "combase.dll";
9 |
10 | [LibraryImport(Combase, EntryPoint = "RoGetActivationFactory", SetLastError = false), PreserveSig]
11 | public static partial int RoGetActivationFactory(IntPtr activatableClassId, in Guid iid, out IntPtr factory);
12 |
13 | [LibraryImport(Combase, EntryPoint = "WindowsCreateString", SetLastError = false, StringMarshalling = StringMarshalling.Utf16), PreserveSig]
14 | public static partial int WindowsCreateString([MarshalAs(UnmanagedType.LPWStr)] string sourceString, int length, out IntPtr hstring);
15 |
16 | [LibraryImport(Combase, EntryPoint = "WindowsDeleteString", SetLastError = false), PreserveSig]
17 | public static partial int WindowsDeleteString(IntPtr hstring);
18 |
19 | [LibraryImport(Combase, EntryPoint = "WindowsGetStringRawBuffer", SetLastError = false), PreserveSig]
20 | public static partial IntPtr WindowsGetStringRawBuffer(IntPtr hstring, out int length);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/PInvoke/Comctl32/Comctl32Library.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.User32;
4 |
5 | namespace MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.Comctl32
6 | {
7 | public static partial class Comctl32Library
8 | {
9 | private const string Comctl32 = "comctl32.dll";
10 |
11 | [LibraryImport(Comctl32, EntryPoint = "SetWindowSubclass", SetLastError = false), PreserveSig]
12 | [return: MarshalAs(UnmanagedType.Bool)]
13 | public static partial bool SetWindowSubclass(IntPtr hWnd, IntPtr pfnSubclass, uint uIdSubclass, IntPtr dwRefData);
14 |
15 | [LibraryImport(Comctl32, EntryPoint = "DefSubclassProc", SetLastError = false), PreserveSig]
16 | public static partial IntPtr DefSubclassProc(IntPtr hWnd, WindowMessage uMsg, UIntPtr wParam, IntPtr lParam);
17 |
18 | [LibraryImport(Comctl32, EntryPoint = "RemoveWindowSubclass", SetLastError = false)]
19 | [return: MarshalAs(UnmanagedType.Bool)]
20 | public static partial bool RemoveWindowSubclass(IntPtr hWnd, IntPtr pfnSubclass, uint uIdSubclass);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/PInvoke/Comctl32/SUBCLASSPROC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.User32;
3 |
4 | namespace MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.Comctl32
5 | {
6 | public delegate IntPtr SUBCLASSPROC(IntPtr hWnd, WindowMessage uMsg, UIntPtr wParam, IntPtr lParam, uint uIdSubclass, IntPtr dwRefData);
7 | }
8 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/PInvoke/Kernel32/Kernel32Library.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.Kernel32
4 | {
5 | public static partial class Kernel32Library
6 | {
7 | private const string Kernel32 = "kernel32.dll";
8 |
9 | public const long APPMODEL_ERROR_NO_PACKAGE = 15700L;
10 |
11 | [LibraryImport(Kernel32, EntryPoint = "GetSystemPowerStatus", SetLastError = false)]
12 | [return: MarshalAs(UnmanagedType.Bool)]
13 | public static partial bool GetSystemPowerStatus(out SYSTEM_POWER_STATUS lpSystemPowerStatus);
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/PInvoke/Kernel32/SYSTEM_POWER_STATUS.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.Kernel32
4 | {
5 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
6 | public struct SYSTEM_POWER_STATUS
7 | {
8 | public byte ACLineStatus;
9 | public byte BatteryFlag;
10 | public byte BatteryLifePercent;
11 | public byte SystemStatusFlag;
12 | public int BatteryLifeTime;
13 | public int BatteryFullLifeTime;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/PInvoke/User32/POWERBROADCAST_SETTING.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.User32
5 | {
6 | [StructLayout(LayoutKind.Sequential)]
7 | public struct POWERBROADCAST_SETTING
8 | {
9 | public Guid PowerSetting;
10 |
11 | public uint DataLength;
12 |
13 | public byte Data;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetCore/WindowsAPI/PInvoke/User32/User32Library.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace MileXamlControlsDemoNetCore.WindowsAPI.PInvoke.User32
5 | {
6 | public static partial class User32Library
7 | {
8 | private const string User32 = "user32.dll";
9 |
10 | [LibraryImport(User32, EntryPoint = "RegisterPowerSettingNotification", SetLastError = false)]
11 | public static partial IntPtr RegisterPowerSettingNotification(IntPtr hRecipient, ref Guid PowerSettingGuid, uint Flags);
12 |
13 | [LibraryImport(User32, EntryPoint = "UnregisterPowerSettingNotification", SetLastError = false)]
14 | [return: MarshalAs(UnmanagedType.Bool)]
15 | public static partial bool UnregisterPowerSettingNotification(IntPtr handle);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/App.manifest:
--------------------------------------------------------------------------------
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 | False
26 | False
27 | True/PM
28 | True
29 | True
30 | True
31 | True
32 | False
33 | PerMonitorV2, PerMonitor, System, Unaware
34 | True
35 | False
36 | UTF-8
37 | SegmentHeap
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/App.xaml:
--------------------------------------------------------------------------------
1 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/App.xaml.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using Windows.UI.Xaml;
3 |
4 | namespace MileXamlControlsDemoNetFramework
5 | {
6 | sealed partial class App : Application
7 | {
8 | public App()
9 | {
10 | this.ThreadInitialize();
11 | this.InitializeComponent();
12 | }
13 |
14 | public void Close()
15 | {
16 | this.Exit();
17 | this.ThreadUninitialize();
18 | }
19 | }
20 | }
21 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/Form1.Designer.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework
2 | {
3 | partial class Form1
4 | {
5 | ///
6 | /// Required designer variable.
7 | ///
8 | private System.ComponentModel.IContainer components = null;
9 |
10 | ///
11 | /// Clean up any resources being used.
12 | ///
13 | /// true if managed resources should be disposed; otherwise, false.
14 | protected override void Dispose(bool disposing)
15 | {
16 | if (disposing && (components != null))
17 | {
18 | components.Dispose();
19 | }
20 | base.Dispose(disposing);
21 | }
22 |
23 | #region Windows Form Designer generated code
24 |
25 | ///
26 | /// Required method for Designer support - do not modify
27 | /// the contents of this method with the code editor.
28 | ///
29 | private void InitializeComponent()
30 | {
31 | this.SuspendLayout();
32 | //
33 | // Form1
34 | //
35 | this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 15F);
36 | this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
37 | this.ClientSize = new System.Drawing.Size(2000, 900);
38 | this.Name = "Form1";
39 | this.Text = "MileXamlControlsDemo (.Net Framework)";
40 | this.ResumeLayout(false);
41 |
42 | }
43 |
44 | #endregion
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/Form1.cs:
--------------------------------------------------------------------------------
1 | using Mile.Xaml;
2 | using System;
3 | using System.Windows.Forms;
4 | using Windows.UI.Xaml;
5 |
6 | namespace MileXamlControlsDemoNetFramework
7 | {
8 | public partial class Form1 : Form
9 | {
10 | WindowsXamlHost xamlHost = new WindowsXamlHost();
11 |
12 | public Form1()
13 | {
14 | InitializeComponent();
15 |
16 |
17 | this.Controls.Add(xamlHost);
18 | xamlHost.AutoSize = true;
19 | xamlHost.Dock = DockStyle.Fill;
20 | xamlHost.Child = new MainPage();
21 |
22 | this.Load += Form1_Load;
23 |
24 | //ContainerControl control = new ContainerControl();
25 | //this.Controls.Add(control);
26 | //control.Dock = DockStyle.Fill;
27 | }
28 |
29 | private void Form1_Load(object sender, EventArgs e)
30 | {
31 |
32 | }
33 | }
34 | }
35 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/Helpers/BackdropHelper.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using System.Windows.Forms;
4 | using Windows.System;
5 | using Windows.UI.Composition.Desktop;
6 | using Windows.UI.Xaml;
7 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
8 | using MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.Combase;
9 |
10 | namespace MileXamlControlsDemoNetFramework.Backdrop
11 | {
12 | public static class BackdropHelper
13 | {
14 | public static Lazy PropertyValueStatics { get; } = new(() => GetActivationFactory("Windows.Foundation.PropertyValue", typeof(IPropertyValueStatics).GUID));
15 |
16 | public static T GetActivationFactory(string activatableClassId, Guid iid)
17 | {
18 | if (!string.IsNullOrEmpty(activatableClassId))
19 | {
20 | CombaseLibrary.RoGetActivationFactory(activatableClassId, iid, out IntPtr comp);
21 | return (T)Marshal.GetObjectForIUnknown(comp);
22 | }
23 | else
24 | {
25 | return default;
26 | }
27 | }
28 |
29 | public static DesktopWindowTarget InitializeDesktopWindowTarget(Form form, bool isTopMost)
30 | {
31 | if (form.Handle == IntPtr.Zero)
32 | {
33 | throw new NullReferenceException("Form window not initialized");
34 | }
35 |
36 | DesktopWindowTarget desktopWindowTarget = null;
37 | if (DispatcherQueue.GetForCurrentThread() is not null)
38 | {
39 | ICompositorDesktopInterop interop = Window.Current.Compositor as object as ICompositorDesktopInterop;
40 | interop.CreateDesktopWindowTarget(form.Handle, isTopMost, out desktopWindowTarget);
41 | }
42 | return desktopWindowTarget;
43 | }
44 | }
45 | }
46 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/MileXamlControlsDemoNetFramework.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | WinExe
5 | net48
6 | 10.0.22621.0
7 | 10.0.19041.0
8 | latest
9 | App.manifest
10 | true
11 |
12 | $(TargetPlatformMinVersion)
13 | true
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 |
24 | Always
25 |
26 |
27 |
28 |
29 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/Program.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Windows.Forms;
3 |
4 | namespace MileXamlControlsDemoNetFramework
5 | {
6 | public static class Program
7 | {
8 | public static Form MainForm { get; private set; }
9 |
10 | [STAThread]
11 | private static void Main()
12 | {
13 | Application.EnableVisualStyles();
14 | Application.SetCompatibleTextRenderingDefault(false);
15 |
16 | App app = new();
17 |
18 | MainForm = new Form1();
19 | Application.Run(MainForm);
20 |
21 | app.Close();
22 | app.Close();
23 | }
24 | }
25 | }
26 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/Resources/NoiseAsset_256x256_PNG.png:
--------------------------------------------------------------------------------
https://raw.githubusercontent.com/ProjectMile/Mile.Xaml.Samples/44421db01d893b429e25f95ab64eaee18802cd50/MileXamlControlsDemoNetFramework/Resources/NoiseAsset_256x256_PNG.png
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/TreeViewItemModel.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Collections.ObjectModel;
4 | using System.Linq;
5 | using System.Text;
6 | using System.Threading.Tasks;
7 |
8 | namespace MileXamlControlsDemoNetFramework
9 | {
10 | public class TreeViewItemModel
11 | {
12 | public bool IsSelected { get; set; }
13 | public string Name { get; set; }
14 | public ObservableCollection ChildrenNode { get; set; }
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/BlendEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Graphics.Effects;
4 | using MileXamlControlsDemoNetFramework.Backdrop;
5 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
6 |
7 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
8 | {
9 | [Guid("81C5B77B-13F8-4CDD-AD20-C890547AC65D")]
10 | public class BlendEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
11 | {
12 | private Guid clsid = new("81C5B77B-13F8-4CDD-AD20-C890547AC65D");
13 |
14 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
15 |
16 | public bool CacheOutput { get; set; }
17 |
18 | public BlendEffectMode Mode { get; set; } = BlendEffectMode.Multiply;
19 |
20 | public IGraphicsEffectSource Background { get; set; }
21 |
22 | public IGraphicsEffectSource Foreground { get; set; }
23 |
24 | private string _name = string.Empty;
25 |
26 | public string Name
27 | {
28 | get { return _name; }
29 |
30 | set { _name = value; }
31 | }
32 |
33 | public int GetEffectId(out Guid id)
34 | {
35 | id = clsid;
36 | return 0;
37 | }
38 |
39 | public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
40 | {
41 | switch (name)
42 | {
43 | case nameof(Mode):
44 | {
45 | index = 0;
46 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
47 | break;
48 | }
49 | default:
50 | {
51 | index = 0xFF;
52 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
53 | break;
54 | }
55 | }
56 |
57 | return 0;
58 | }
59 |
60 | public int GetProperty(uint index, out IntPtr source)
61 | {
62 | if (index is 0)
63 | {
64 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)Mode, out IntPtr ptr);
65 | if (ptr != IntPtr.Zero)
66 | {
67 | source = ptr;
68 | return 0;
69 | }
70 | }
71 |
72 | source = IntPtr.Zero;
73 | return -2147483637;
74 | }
75 |
76 | public int GetPropertyCount(out uint count)
77 | {
78 | count = 1;
79 | return 0;
80 | }
81 |
82 | public int GetSource(uint index, out IntPtr source)
83 | {
84 | if (index is 0)
85 | {
86 | source = Marshal.GetComInterfaceForObject(Background, typeof(IGraphicsEffectSource));
87 | return 0;
88 | }
89 | else if (index is 1)
90 | {
91 | source = Marshal.GetComInterfaceForObject(Foreground, typeof(IGraphicsEffectSource));
92 | return 0;
93 | }
94 | else
95 | {
96 | source = IntPtr.Zero;
97 | return 2147483637;
98 | }
99 | }
100 |
101 | public int GetSourceCount(out uint count)
102 | {
103 | count = 2;
104 | return 0;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/BlendEffectMode.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
2 | {
3 | public enum BlendEffectMode
4 | {
5 | Multiply = 0,
6 | Screen = 1,
7 | Darken = 2,
8 | Lighten = 3,
9 | Dissolve = 4,
10 | ColorBurn = 5,
11 | LinearBurn = 6,
12 | DarkerColor = 7,
13 | LighterColor = 8,
14 | ColorDodge = 9,
15 | LinearDodge = 10,
16 | Overlay = 11,
17 | SoftLight = 12,
18 | HardLight = 13,
19 | VividLight = 14,
20 | LinearLight = 15,
21 | PinLight = 16,
22 | HardMix = 17,
23 | Difference = 18,
24 | Exclusion = 19,
25 | Hue = 20,
26 | Saturation = 21,
27 | Color = 22,
28 | Luminosity = 23,
29 | Subtract = 24,
30 | Division = 25
31 | }
32 | }
33 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/BorderEffect.cs:
--------------------------------------------------------------------------------
1 | using MileXamlControlsDemoNetFramework.Backdrop;
2 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
3 | using System;
4 | using System.Runtime.InteropServices;
5 | using Windows.Graphics.Effects;
6 |
7 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
8 | {
9 | [Guid("2A2D49C0-4ACF-43C7-8C6A-7C4A27874D27")]
10 | public class BorderEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
11 | {
12 | private Guid clsid = new("2A2D49C0-4ACF-43C7-8C6A-7C4A27874D27");
13 |
14 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
15 |
16 | public bool CacheOutput { get; set; }
17 |
18 | public CanvasEdgeBehavior ExtendX { get; set; } = CanvasEdgeBehavior.Clamp;
19 |
20 | public CanvasEdgeBehavior ExtendY { get; set; } = CanvasEdgeBehavior.Clamp;
21 |
22 | public IGraphicsEffectSource Source { get; set; }
23 |
24 | private string _name = string.Empty;
25 |
26 | public string Name
27 | {
28 | get { return _name; }
29 |
30 | set { _name = value; }
31 | }
32 |
33 | public int GetEffectId(out Guid id)
34 | {
35 | id = clsid;
36 | return 0;
37 | }
38 |
39 | public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
40 | {
41 | switch (name)
42 | {
43 | case nameof(ExtendX):
44 | {
45 | index = 0;
46 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
47 | break;
48 | }
49 | case nameof(ExtendY):
50 | {
51 | index = 1;
52 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
53 | break;
54 | }
55 | default:
56 | {
57 | index = 0xFF;
58 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
59 | break;
60 | }
61 | }
62 |
63 | return 0;
64 | }
65 |
66 | public int GetProperty(uint index, out IntPtr source)
67 | {
68 | if (index is 0)
69 | {
70 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)ExtendX, out IntPtr ptr);
71 |
72 | if (ptr != IntPtr.Zero)
73 | {
74 | source = ptr;
75 | return 0;
76 | }
77 | }
78 | else if (index is 1)
79 | {
80 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)ExtendY, out IntPtr ptr);
81 |
82 | if (ptr != IntPtr.Zero)
83 | {
84 | source = ptr;
85 | return 0;
86 | }
87 | }
88 |
89 | source = IntPtr.Zero;
90 | return -2147483637;
91 | }
92 |
93 | public int GetPropertyCount(out uint count)
94 | {
95 | count = 2;
96 | return 0;
97 | }
98 |
99 | public int GetSource(uint index, out IntPtr source)
100 | {
101 | if (index is 0)
102 | {
103 | source = Marshal.GetComInterfaceForObject(Source, typeof(IGraphicsEffectSource));
104 | return 0;
105 | }
106 | else
107 | {
108 | source = IntPtr.Zero;
109 | return 2147483637;
110 | }
111 | }
112 |
113 | public int GetSourceCount(out uint count)
114 | {
115 | count = 1;
116 | return 0;
117 | }
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/CanvasComposite.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
2 | {
3 | public enum CanvasComposite
4 | {
5 | SourceOver = 0,
6 | DestinationOver = 1,
7 | SourceIn = 2,
8 | DestinationIn = 3,
9 | SourceOut = 4,
10 | DestinationOut = 5,
11 | SourceAtop = 6,
12 | DestinationAtop = 7,
13 | Xor = 8,
14 | Add = 9,
15 | Copy = 10,
16 | BoundedCopy = 11,
17 | MaskInvert = 12
18 | }
19 | }
20 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/CanvasEdgeBehavior.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
2 | {
3 | public enum CanvasEdgeBehavior
4 | {
5 | Clamp = 0,
6 | Wrap = 1,
7 | Mirror = 2
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/ColorSourceEffect.cs:
--------------------------------------------------------------------------------
1 | using MileXamlControlsDemoNetFramework.Backdrop;
2 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
3 | using System;
4 | using System.Numerics;
5 | using System.Runtime.InteropServices;
6 | using Windows.Graphics.Effects;
7 | using Windows.UI;
8 |
9 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
10 | {
11 | [Guid("61C23C20-AE69-4D8E-94CF-50078DF638F2")]
12 | public class ColorSourceEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
13 | {
14 | private Guid clsid = new("61C23C20-AE69-4D8E-94CF-50078DF638F2");
15 |
16 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
17 |
18 | public bool CacheOutput { get; set; }
19 |
20 | public Color Color { get; set; } = Color.FromArgb(255, 255, 255, 255);
21 |
22 | private string _name = string.Empty;
23 |
24 | public string Name
25 | {
26 | get { return _name; }
27 |
28 | set { _name = value; }
29 | }
30 |
31 | public Vector4 ColorHdr
32 | {
33 | get { return new(Color.R * 255.0f, Color.G * 255.0f, Color.B * 255.0f, Color.A * 255.0f); }
34 |
35 | set { Color = Color.FromArgb((byte)(value.W / 255.0f), (byte)(value.X / 255.0f), (byte)(value.Y / 255.0f), (byte)(value.Z / 255.0f)); }
36 | }
37 |
38 | public int GetEffectId(out Guid id)
39 | {
40 | id = clsid;
41 | return 0;
42 | }
43 |
44 | public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
45 | {
46 | switch (name)
47 | {
48 | case nameof(Color):
49 | {
50 | index = 0;
51 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4;
52 | break;
53 | }
54 | default:
55 | {
56 | index = 0xFF;
57 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
58 | break;
59 | }
60 | }
61 |
62 | return 0;
63 | }
64 |
65 | public int GetProperty(uint index, out IntPtr source)
66 | {
67 | if (index is 0)
68 | {
69 | BackdropHelper.PropertyValueStatics.Value.CreateSingleArray(4, [Color.R / 255.0f, Color.G / 255.0f, Color.B / 255.0f, Color.A / 255.0f], out IntPtr ptr);
70 | if (ptr != IntPtr.Zero)
71 | {
72 | source = ptr;
73 | return 0;
74 | }
75 | }
76 |
77 | source = IntPtr.Zero;
78 | return -2147483637;
79 | }
80 |
81 | public int GetPropertyCount(out uint count)
82 | {
83 | count = 1;
84 | return 0;
85 | }
86 |
87 | public int GetSource(uint index, out IntPtr source)
88 | {
89 | source = IntPtr.Zero;
90 | return 0;
91 | }
92 |
93 | public int GetSourceCount(out uint count)
94 | {
95 | count = 0;
96 | return 0;
97 | }
98 | }
99 | }
100 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/CompositeEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Collections.Generic;
3 | using System.Runtime.InteropServices;
4 | using Windows.Graphics.Effects;
5 | using MileXamlControlsDemoNetFramework.Backdrop;
6 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
7 |
8 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
9 | {
10 | [Guid("48FC9F51-F6AC-48F1-8B58-3B28AC46F76D")]
11 | public class CompositeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
12 | {
13 | private Guid clsid = new("48FC9F51-F6AC-48F1-8B58-3B28AC46F76D");
14 |
15 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
16 |
17 | public bool CacheOutput { get; set; }
18 |
19 | public CanvasComposite Mode { get; set; } = CanvasComposite.SourceOver;
20 |
21 | private string _name = string.Empty;
22 |
23 | public string Name
24 | {
25 | get { return _name; }
26 |
27 | set { _name = value; }
28 | }
29 |
30 | public List Sources { get; set; } = [];
31 |
32 | public int GetEffectId(out Guid id)
33 | {
34 | id = clsid;
35 | return 0;
36 | }
37 |
38 | public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
39 | {
40 | switch (name)
41 | {
42 | case nameof(Mode):
43 | {
44 | index = 0;
45 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
46 | break;
47 | }
48 | default:
49 | {
50 | index = 0xFF;
51 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
52 | break;
53 | }
54 | }
55 |
56 | return 0;
57 | }
58 |
59 | public int GetProperty(uint index, out IntPtr source)
60 | {
61 | if (index is 0)
62 | {
63 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)Mode, out IntPtr ptr);
64 |
65 | if (ptr != IntPtr.Zero)
66 | {
67 | source = ptr;
68 | return 0;
69 | }
70 | }
71 |
72 | source = IntPtr.Zero;
73 | return -2147483637;
74 | }
75 |
76 | public int GetPropertyCount(out uint count)
77 | {
78 | count = 1;
79 | return 0;
80 | }
81 |
82 | public int GetSource(uint index, out IntPtr source)
83 | {
84 | if (index < Sources.Count)
85 | {
86 | source = Marshal.GetComInterfaceForObject(Sources[(int)index], typeof(IGraphicsEffectSource));
87 | return 0;
88 | }
89 | else
90 | {
91 | source = IntPtr.Zero;
92 | return 2147483637;
93 | }
94 | }
95 |
96 | public int GetSourceCount(out uint count)
97 | {
98 | count = (uint)Sources.Count;
99 | return 0;
100 | }
101 | }
102 | }
103 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/CrossFadeEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Graphics.Effects;
4 | using MileXamlControlsDemoNetFramework.Backdrop;
5 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
6 |
7 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
8 | {
9 | [Guid("12F575E8-4DB1-485F-9A84-03A07DD3829F")]
10 | public class CrossFadeEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
11 | {
12 | private Guid clsid = new("12F575E8-4DB1-485F-9A84-03A07DD3829F");
13 |
14 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
15 |
16 | public bool CacheOutput { get; set; }
17 |
18 | public float CrossFade { get; set; } = 0.5f;
19 |
20 | public IGraphicsEffectSource Source1 { get; set; }
21 |
22 | public IGraphicsEffectSource Source2 { get; set; }
23 |
24 | private string _name = string.Empty;
25 |
26 | public string Name
27 | {
28 | get { return _name; }
29 |
30 | set { _name = value; }
31 | }
32 |
33 | public int GetEffectId(out Guid id)
34 | {
35 | id = clsid;
36 | return 0;
37 | }
38 |
39 | public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
40 | {
41 | switch (name)
42 | {
43 | case nameof(CrossFade):
44 | {
45 | index = 0;
46 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
47 | break;
48 | }
49 | default:
50 | {
51 | index = 0xFF;
52 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
53 | break;
54 | }
55 | }
56 |
57 | return 0;
58 | }
59 |
60 | public int GetProperty(uint index, out IntPtr source)
61 | {
62 | if (index is 0)
63 | {
64 | BackdropHelper.PropertyValueStatics.Value.CreateSingle((float)CrossFade, out IntPtr ptr);
65 | if (ptr != IntPtr.Zero)
66 | {
67 | source = ptr;
68 | return 0;
69 | }
70 | }
71 |
72 | source = IntPtr.Zero;
73 | return -2147483637;
74 | }
75 |
76 | public int GetPropertyCount(out uint count)
77 | {
78 | count = 1;
79 | return 0;
80 | }
81 |
82 | public int GetSource(uint index, out IntPtr source)
83 | {
84 | if (index is 0)
85 | {
86 | source = Marshal.GetComInterfaceForObject(Source1, typeof(IGraphicsEffectSource));
87 | return 0;
88 | }
89 | else if (index is 1)
90 | {
91 | source = Marshal.GetComInterfaceForObject(Source2, typeof(IGraphicsEffectSource));
92 | return 0;
93 | }
94 | else
95 | {
96 | source = IntPtr.Zero;
97 | return 2147483637;
98 | }
99 | }
100 |
101 | public int GetSourceCount(out uint count)
102 | {
103 | count = 2;
104 | return 0;
105 | }
106 | }
107 | }
108 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/DesktopAcrylicKind.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
2 | {
3 | public enum DesktopAcrylicKind
4 | {
5 | Default = 0,
6 |
7 | Base = 1,
8 |
9 | Thin = 2
10 | }
11 | }
12 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/EffectBorderMode.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
2 | {
3 | public enum EffectBorderMode
4 | {
5 | Soft = 0,
6 | Hard = 1
7 | }
8 | }
9 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/EffectOptimization.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
2 | {
3 | public enum EffectOptimization
4 | {
5 | Speed = 0,
6 | Balanced = 1,
7 | Quality = 2
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/GaussianBlurEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Graphics.Effects;
4 | using MileXamlControlsDemoNetFramework.Backdrop;
5 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
6 |
7 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
8 | {
9 | [Guid("1FEB6D69-2FE6-4AC9-8C58-1D7F93E7A6A5")]
10 | public class GaussianBlurEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
11 | {
12 | private Guid clsid = new("1FEB6D69-2FE6-4AC9-8C58-1D7F93E7A6A5");
13 |
14 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
15 |
16 | public bool CacheOutput { get; set; }
17 |
18 | public IGraphicsEffectSource Source { get; set; }
19 |
20 | public float BlurAmount { get; set; } = 3.0f;
21 |
22 | public EffectOptimization Optimization { get; set; } = EffectOptimization.Balanced;
23 |
24 | public EffectBorderMode BorderMode { get; set; } = EffectBorderMode.Soft;
25 |
26 | private string _name = string.Empty;
27 |
28 | public string Name
29 | {
30 | get { return _name; }
31 |
32 | set { _name = value; }
33 | }
34 |
35 | public int GetEffectId(out Guid id)
36 | {
37 | id = clsid;
38 | return 0;
39 | }
40 |
41 | public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
42 | {
43 | switch (name)
44 | {
45 | case nameof(BlurAmount):
46 | {
47 | index = 0;
48 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
49 | break;
50 | }
51 | case nameof(Optimization):
52 | {
53 | index = 1;
54 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
55 | break;
56 | }
57 | case nameof(BorderMode):
58 | {
59 | index = 2;
60 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
61 | break;
62 | }
63 | default:
64 | {
65 | index = 0xFF;
66 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
67 | break;
68 | }
69 | }
70 |
71 | return 0;
72 | }
73 |
74 | public int GetProperty(uint index, out IntPtr source)
75 | {
76 | if (index is 0)
77 | {
78 | BackdropHelper.PropertyValueStatics.Value.CreateSingle(BlurAmount, out IntPtr ptr);
79 |
80 | if (ptr != IntPtr.Zero)
81 | {
82 | source = ptr;
83 | return 0;
84 | }
85 | }
86 | else if (index is 1)
87 | {
88 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)Optimization, out IntPtr ptr);
89 |
90 | if (ptr != IntPtr.Zero)
91 | {
92 | source = ptr;
93 | return 0;
94 | }
95 | }
96 | else if (index is 2)
97 | {
98 | BackdropHelper.PropertyValueStatics.Value.CreateUInt32((uint)BorderMode, out IntPtr ptr);
99 |
100 | if (ptr != IntPtr.Zero)
101 | {
102 | source = ptr;
103 | return 0;
104 | }
105 | }
106 |
107 | source = IntPtr.Zero;
108 | return -2147483637;
109 | }
110 |
111 | public int GetPropertyCount(out uint count)
112 | {
113 | count = 3;
114 | return 0;
115 | }
116 |
117 | public int GetSource(uint index, out IntPtr source)
118 | {
119 | if (index is 0)
120 | {
121 | source = Marshal.GetComInterfaceForObject(Source, typeof(IGraphicsEffectSource));
122 | return 0;
123 | }
124 | else
125 | {
126 | source = IntPtr.Zero;
127 | return 2147483637;
128 | }
129 | }
130 |
131 | public int GetSourceCount(out uint count)
132 | {
133 | count = 1;
134 | return 0;
135 | }
136 | }
137 | }
138 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/MicaKind.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
2 | {
3 | public enum MicaKind
4 | {
5 | Base = 0,
6 |
7 | BaseAlt = 1
8 | }
9 | }
10 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/OpacityEffect.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Graphics.Effects;
4 | using MileXamlControlsDemoNetFramework.Backdrop;
5 | using MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes;
6 |
7 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
8 | {
9 | [Guid("811D79A4-DE28-4454-8094-C64685F8BD4C")]
10 | public class OpacityEffect : IGraphicsEffect, IGraphicsEffectSource, IGraphicsEffectD2D1Interop
11 | {
12 | private Guid clsid = new("811D79A4-DE28-4454-8094-C64685F8BD4C");
13 |
14 | public D2D1_BUFFER_PRECISION BufferPrecision { get; set; }
15 |
16 | public bool CacheOutput { get; set; }
17 |
18 | public float Opacity { get; set; } = 1.0f;
19 |
20 | public IGraphicsEffectSource Source { get; set; }
21 |
22 | private string _name = string.Empty;
23 |
24 | public string Name
25 | {
26 | get { return _name; }
27 |
28 | set { _name = value; }
29 | }
30 |
31 | public int GetEffectId(out Guid id)
32 | {
33 | id = clsid;
34 | return 0;
35 | }
36 |
37 | public static bool IsSupported
38 | {
39 | get { return true; }
40 | }
41 |
42 | public int GetNamedPropertyMapping(string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping)
43 | {
44 | switch (name)
45 | {
46 | case nameof(Opacity):
47 | {
48 | index = 0;
49 | mapping = GRAPHICS_EFFECT_PROPERTY_MAPPING.GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT;
50 | break;
51 | }
52 | default:
53 | {
54 | index = 0xFF;
55 | mapping = (GRAPHICS_EFFECT_PROPERTY_MAPPING)0xFF;
56 | break;
57 | }
58 | }
59 |
60 | return 0;
61 | }
62 |
63 | public int GetProperty(uint index, out IntPtr source)
64 | {
65 | if (index is 0)
66 | {
67 | BackdropHelper.PropertyValueStatics.Value.CreateSingle(Opacity, out IntPtr ptr);
68 | if (ptr != IntPtr.Zero)
69 | {
70 | source = ptr;
71 | return 0;
72 | }
73 | }
74 |
75 | source = IntPtr.Zero;
76 | return -2147483637;
77 | }
78 |
79 | public int GetPropertyCount(out uint count)
80 | {
81 | count = 1;
82 | return 0;
83 | }
84 |
85 | public int GetSource(uint index, out IntPtr source)
86 | {
87 | source = Marshal.GetComInterfaceForObject(Source, typeof(IGraphicsEffectSource));
88 | return 0;
89 | }
90 |
91 | public int GetSourceCount(out uint count)
92 | {
93 | count = 1;
94 | return 0;
95 | }
96 | }
97 | }
98 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/UI/Backdrop/SystemBackdrop.cs:
--------------------------------------------------------------------------------
1 | using Microsoft.Win32;
2 | using System;
3 | using Windows.UI;
4 | using Windows.UI.Composition.Desktop;
5 | using Windows.UI.Xaml;
6 |
7 | namespace MileXamlControlsDemoNetFramework.UI.Backdrop
8 | {
9 | public abstract class SystemBackdrop(DesktopWindowTarget target) : IDisposable
10 | {
11 | public abstract float LightTintOpacity { get; set; }
12 |
13 | public abstract float LightLuminosityOpacity { get; set; }
14 |
15 | public abstract float DarkTintOpacity { get; set; }
16 |
17 | public abstract float DarkLuminosityOpacity { get; set; }
18 |
19 | public abstract Color LightTintColor { get; set; }
20 |
21 | public abstract Color LightFallbackColor { get; set; }
22 |
23 | public abstract Color DarkTintColor { get; set; }
24 |
25 | public abstract Color DarkFallbackColor { get; set; }
26 |
27 | public abstract ElementTheme RequestedTheme { get; set; }
28 |
29 | public abstract bool IsInputActive { get; set; }
30 |
31 | public abstract bool IsSupported { get; }
32 |
33 | public DesktopWindowTarget DesktopWindowTarget { get; } = target;
34 |
35 | public abstract void InitializeBackdrop();
36 |
37 | public abstract void ResetProperties();
38 |
39 | public abstract void Dispose();
40 |
41 | protected bool IsAdvancedEffectsEnabled()
42 | {
43 | RegistryKey key = Registry.CurrentUser.OpenSubKey(@"SOFTWARE\Microsoft\Windows\CurrentVersion\Themes\Personalize");
44 | if (key is not null)
45 | {
46 | object value = key.GetValue("EnableTransparency");
47 | if (value is not null && Convert.ToInt32(value) is 1)
48 | {
49 | return true;
50 | }
51 | }
52 |
53 | return false;
54 | }
55 | }
56 | }
57 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/ComTypes/D2D1_BUFFER_PRECISION.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes
2 | {
3 | public enum D2D1_BUFFER_PRECISION : uint
4 | {
5 | D2D1_BUFFER_PRECISION_UNKNOWN = 0,
6 | D2D1_BUFFER_PRECISION_8BPC_UNORM = 1,
7 | D2D1_BUFFER_PRECISION_8BPC_UNORM_SRGB = 2,
8 | D2D1_BUFFER_PRECISION_16BPC_UNORM = 3,
9 | D2D1_BUFFER_PRECISION_16BPC_FLOAT = 4,
10 | D2D1_BUFFER_PRECISION_32BPC_FLOAT = 5,
11 | D2D1_BUFFER_PRECISION_FORCE_DWORD = 0xffffffff
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/ComTypes/GRAPHICS_EFFECT_PROPERTY_MAPPING.cs:
--------------------------------------------------------------------------------
1 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes
2 | {
3 | public enum GRAPHICS_EFFECT_PROPERTY_MAPPING
4 | {
5 | GRAPHICS_EFFECT_PROPERTY_MAPPING_UNKNOWN = 0,
6 |
7 | GRAPHICS_EFFECT_PROPERTY_MAPPING_DIRECT = 1,
8 |
9 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORX = 2,
10 |
11 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORY = 3,
12 |
13 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORZ = 4,
14 |
15 | GRAPHICS_EFFECT_PROPERTY_MAPPING_VECTORW = 5,
16 |
17 | GRAPHICS_EFFECT_PROPERTY_MAPPING_RECT_TO_VECTOR4 = 6,
18 |
19 | GRAPHICS_EFFECT_PROPERTY_MAPPING_RADIANS_TO_DEGREES = 7,
20 |
21 | GRAPHICS_EFFECT_PROPERTY_MAPPING_COLORMATRIX_ALPHA_MODE = 8,
22 |
23 | GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR3 = 9,
24 |
25 | GRAPHICS_EFFECT_PROPERTY_MAPPING_COLOR_TO_VECTOR4 = 10
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/ComTypes/ICompositorDesktopInterop.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.UI.Composition.Desktop;
4 |
5 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes
6 | {
7 | [ComImport, Guid("29E691FA-4567-4DCA-B319-D0F207EB6807"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
8 | public interface ICompositorDesktopInterop
9 | {
10 | [PreserveSig]
11 | int CreateDesktopWindowTarget(IntPtr hwndTarget, bool isTopmost, out DesktopWindowTarget result);
12 |
13 | [PreserveSig]
14 | int EnsureOnThread(int threadId);
15 | }
16 | }
17 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/ComTypes/IGraphicsEffectD2D1Interop.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes
5 | {
6 | [ComImport, Guid("2FC57384-A068-44D7-A331-30982FCF7177"), InterfaceType(ComInterfaceType.InterfaceIsIUnknown)]
7 | public interface IGraphicsEffectD2D1Interop
8 | {
9 | [PreserveSig]
10 | int GetEffectId(out Guid id);
11 |
12 | [PreserveSig]
13 | int GetNamedPropertyMapping([MarshalAs(UnmanagedType.LPWStr)] string name, out uint index, out GRAPHICS_EFFECT_PROPERTY_MAPPING mapping);
14 |
15 | [PreserveSig]
16 | int GetPropertyCount(out uint count);
17 |
18 | [PreserveSig]
19 | int GetProperty(uint index, out IntPtr value);
20 |
21 | [PreserveSig]
22 | int GetSource(uint index, out IntPtr source);
23 |
24 | [PreserveSig]
25 | int GetSourceCount(out uint count);
26 | }
27 | }
28 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/ComTypes/IPropertyValueStatics.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using Windows.Foundation;
4 |
5 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.ComTypes
6 | {
7 | [ComImport, Guid("629BDBC8-D932-4FF4-96B9-8D96C5C1E858"), InterfaceType(ComInterfaceType.InterfaceIsIInspectable)]
8 | public interface IPropertyValueStatics
9 | {
10 | [PreserveSig]
11 | int CreateEmpty(out IntPtr propertyValue);
12 |
13 | [PreserveSig]
14 | int CreateUInt8(byte value, out IntPtr propertyValue);
15 |
16 | [PreserveSig]
17 | int CreateInt16(short value, out IntPtr propertyValue);
18 |
19 | [PreserveSig]
20 | int CreateUInt16(ushort value, out IntPtr propertyValue);
21 |
22 | [PreserveSig]
23 | int CreateInt32(int value, out IntPtr propertyValue);
24 |
25 | [PreserveSig]
26 | int CreateUInt32(uint value, out IntPtr propertyValue);
27 |
28 | [PreserveSig]
29 | int CreateInt64(long value, out IntPtr propertyValue);
30 |
31 | [PreserveSig]
32 | int CreateUInt64(ulong value, out IntPtr propertyValue);
33 |
34 | [PreserveSig]
35 | int CreateSingle(float value, out IntPtr propertyValue);
36 |
37 | [PreserveSig]
38 | int CreateDouble(double value, out IntPtr propertyValue);
39 |
40 | [PreserveSig]
41 | int CreateChar16(char value, out IntPtr propertyValue);
42 |
43 | [PreserveSig]
44 | int CreateBoolean(bool value, out IntPtr propertyValue);
45 |
46 | [PreserveSig]
47 | int CreateString(IntPtr value, out IntPtr propertyValue);
48 |
49 | [PreserveSig]
50 | int CreateInspectable([MarshalAs(UnmanagedType.IUnknown)] object value, out IntPtr propertyValue);
51 |
52 | [PreserveSig]
53 | int CreateGuid(Guid value, out IntPtr propertyValue);
54 |
55 | [PreserveSig]
56 | int CreateDateTime(DateTime value, out IntPtr propertyValue);
57 |
58 | [PreserveSig]
59 | int CreateTimeSpan(TimeSpan value, out IntPtr propertyValue);
60 |
61 | [PreserveSig]
62 | int CreatePoint(Point value, out IntPtr propertyValue);
63 |
64 | [PreserveSig]
65 | int CreateSize(Size value, out IntPtr propertyValue);
66 |
67 | [PreserveSig]
68 | int CreateRect(Rect value, out IntPtr propertyValue);
69 |
70 | [PreserveSig]
71 | int CreateUInt8Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] byte[] value, out IntPtr propertyValue);
72 |
73 | [PreserveSig]
74 | int CreateInt16Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] short[] value, out IntPtr propertyValue);
75 |
76 | [PreserveSig]
77 | int CreateUInt16Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ushort[] value, out IntPtr propertyValue);
78 |
79 | [PreserveSig]
80 | int CreateInt32Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] int[] value, out IntPtr propertyValue);
81 |
82 | [PreserveSig]
83 | int CreateUInt32Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] uint[] value, out IntPtr propertyValue);
84 |
85 | [PreserveSig]
86 | int CreateInt64Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] long[] value, out IntPtr propertyValue);
87 |
88 | [PreserveSig]
89 | int CreateUInt64Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] ulong[] value, out IntPtr propertyValue);
90 |
91 | [PreserveSig]
92 | int CreateSingleArray(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] float[] value, out IntPtr propertyValue);
93 |
94 | [PreserveSig]
95 | int CreateDoubleArray(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] double[] value, out IntPtr propertyValue);
96 |
97 | [PreserveSig]
98 | int CreateChar16Array(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] char[] value, out IntPtr propertyValue);
99 |
100 | [PreserveSig]
101 | int CreateBooleanArray(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] bool[] value, out IntPtr propertyValue);
102 |
103 | [PreserveSig]
104 | int CreateStringArray(int valueSize, IntPtr value, out IntPtr propertyValue);
105 |
106 | [PreserveSig]
107 | int CreateInspectableArray(int valueLength, [MarshalAs(UnmanagedType.LPArray, ArraySubType = UnmanagedType.IUnknown, SizeParamIndex = 0)] object[] value, out IntPtr propertyValue);
108 |
109 | [PreserveSig]
110 | int CreateGuidArray(int valueLength, [MarshalAs(UnmanagedType.LPArray, SizeParamIndex = 0)] Guid[] value, out IntPtr propertyValue);
111 |
112 | [PreserveSig]
113 | int CreateDateTimeArray(int valueLength, IntPtr value, out IntPtr propertyValue);
114 |
115 | [PreserveSig]
116 | int CreateTimeSpanArray(int valueLength, IntPtr value, out IntPtr propertyValue);
117 |
118 | [PreserveSig]
119 | int CreatePointArray(int valueLength, IntPtr value, out IntPtr propertyValue);
120 |
121 | [PreserveSig]
122 | int CreateSizeArray(int valueLength, IntPtr value, out IntPtr propertyValue);
123 |
124 | [PreserveSig]
125 | int CreateRectArray(int valueLength, IntPtr value, out IntPtr propertyValue);
126 | }
127 | }
128 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/PInvoke/Combase/CombaseLibrary.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.Combase
5 | {
6 | public static class CombaseLibrary
7 | {
8 | private const string Combase = "combase.dll";
9 |
10 | [DllImport(Combase, CharSet = CharSet.Unicode, ExactSpelling = true, EntryPoint = "RoGetActivationFactory", SetLastError = false)]
11 | public static extern int RoGetActivationFactory([MarshalAs(UnmanagedType.HString)] string activatableClassId, [MarshalAs(UnmanagedType.LPStruct)] Guid iid, out IntPtr factory);
12 | }
13 | }
14 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/PInvoke/Comctl32/Comctl32Library.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 | using MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.User32;
4 |
5 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.Comctl32
6 | {
7 | public static partial class Comctl32Library
8 | {
9 | private const string Comctl32 = "comctl32.dll";
10 |
11 | [DllImport(Comctl32, CharSet = CharSet.Unicode, EntryPoint = "SetWindowSubclass", SetLastError = false)]
12 | [return: MarshalAs(UnmanagedType.Bool)]
13 | public static extern bool SetWindowSubclass(IntPtr hWnd, SUBCLASSPROC pfnSubclass, uint uIdSubclass, IntPtr dwRefData);
14 |
15 | [DllImport(Comctl32, CharSet = CharSet.Unicode, EntryPoint = "DefSubclassProc", SetLastError = false)]
16 | public static extern IntPtr DefSubclassProc(IntPtr hWnd, WindowMessage uMsg, UIntPtr wParam, IntPtr lParam);
17 |
18 | [DllImport(Comctl32, CharSet = CharSet.Unicode, EntryPoint = "RemoveWindowSubclass", SetLastError = false)]
19 | [return: MarshalAs(UnmanagedType.Bool)]
20 | public static extern bool RemoveWindowSubclass(IntPtr hWnd, SUBCLASSPROC pfnSubclass, uint uIdSubclass);
21 | }
22 | }
23 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/PInvoke/Comctl32/SUBCLASSPROC.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.User32;
3 |
4 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.Comctl32
5 | {
6 | public delegate IntPtr SUBCLASSPROC(IntPtr hWnd, WindowMessage uMsg, UIntPtr wParam, IntPtr lParam, uint uIdSubclass, IntPtr dwRefData);
7 | }
8 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/PInvoke/Kernel32/Kernel32Library.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.Kernel32
4 | {
5 | public static class Kernel32Library
6 | {
7 | private const string Kernel32 = "kernel32.dll";
8 |
9 | public const long APPMODEL_ERROR_NO_PACKAGE = 15700L;
10 |
11 | [DllImport(Kernel32, CharSet = CharSet.Unicode, EntryPoint = "GetSystemPowerStatus", SetLastError = false)]
12 | public static extern bool GetSystemPowerStatus(out SYSTEM_POWER_STATUS lpSystemPowerStatus);
13 | }
14 | }
15 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/PInvoke/Kernel32/SYSTEM_POWER_STATUS.cs:
--------------------------------------------------------------------------------
1 | using System.Runtime.InteropServices;
2 |
3 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.Kernel32
4 | {
5 | [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Unicode)]
6 | public struct SYSTEM_POWER_STATUS
7 | {
8 | public byte ACLineStatus;
9 | public byte BatteryFlag;
10 | public byte BatteryLifePercent;
11 | public byte SystemStatusFlag;
12 | public int BatteryLifeTime;
13 | public int BatteryFullLifeTime;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/PInvoke/User32/POWERBROADCAST_SETTING.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.User32
5 | {
6 | [StructLayout(LayoutKind.Sequential)]
7 | public struct POWERBROADCAST_SETTING
8 | {
9 | public Guid PowerSetting;
10 |
11 | public uint DataLength;
12 |
13 | public byte Data;
14 | }
15 | }
16 |
--------------------------------------------------------------------------------
/MileXamlControlsDemoNetFramework/WindowsAPI/PInvoke/User32/User32Library.cs:
--------------------------------------------------------------------------------
1 | using System;
2 | using System.Runtime.InteropServices;
3 |
4 | namespace MileXamlControlsDemoNetFramework.WindowsAPI.PInvoke.User32
5 | {
6 | public static class User32Library
7 | {
8 | private const string User32 = "user32.dll";
9 |
10 | [DllImport(User32, CharSet = CharSet.Unicode, EntryPoint = "RegisterPowerSettingNotification", SetLastError = false)]
11 | public static extern IntPtr RegisterPowerSettingNotification(IntPtr hRecipient, ref Guid PowerSettingGuid, uint Flags);
12 |
13 | [DllImport(User32, CharSet = CharSet.Unicode, EntryPoint = "UnregisterPowerSettingNotification", SetLastError = false)]
14 | [return: MarshalAs(UnmanagedType.Bool)]
15 | public static extern bool UnregisterPowerSettingNotification(IntPtr handle);
16 | }
17 | }
18 |
--------------------------------------------------------------------------------
/ReadMe.md:
--------------------------------------------------------------------------------
1 | # Mile.Xaml.Samples
2 |
3 | Provide samples that demonstrate using XAML Islands with
4 | [Mile.Xaml](https://github.com/ProjectMile/Mile.Xaml).
5 |
6 | If you meet some issue when using implementations in this repo, please fire an
7 | issue at https://github.com/ProjectMile/Mile.Xaml/issues.
8 |
9 | ## Samples List
10 |
11 | ### C++/WinRT
12 |
13 | #### [MileXamlBlankApp](MileXamlBlankApp)
14 |
15 | A project for a single page C++/WinRT XAML Islands app with Mile.Xaml and no
16 | predefined layout.
17 |
18 | #### [MileXamlControlsDemo](MileXamlControlsDemo)
19 |
20 | A project for a single page C++/WinRT XAML Islands app with Mile.Xaml with
21 | modernized Windows 11 style XAML controls.
22 |
23 | ### .NET Framework
24 |
25 | #### [MileXamlBlankAppNetFramework](MileXamlBlankAppNetFramework)
26 |
27 | A project (.NET SDK Style Project) for a single page C# (.NET Framework) XAML
28 | Islands app with Mile.Xaml and no predefined layout.
29 |
30 | #### [MileXamlBlankAppNetFrameworkNativeBackend](MileXamlBlankAppNetFrameworkNativeBackend)
31 |
32 | A project (.NET SDK Style Project) for a single page C# (.NET Framework) XAML
33 | Islands app with Mile.Xaml Native Backend and no predefined layout.
34 |
35 | #### [MileXamlControlsDemoNetFramework](MileXamlControlsDemoNetFramework)
36 |
37 | A project (.NET SDK Style Project) for a single page C# (.NET Framework) XAML
38 | Islands app with Mile.Xaml with modernized Windows 11 style XAML controls.
39 |
40 | ### Modern .NET
41 |
42 | #### [MileXamlBlankAppNetCore](MileXamlBlankAppNetCore)
43 |
44 | A project for a single page C# (Modern .NET) XAML Islands app with Mile.Xaml and
45 | no predefined layout.
46 |
47 | #### [MileXamlBlankAppNetCoreNativeBackend](MileXamlBlankAppNetCoreNativeBackend)
48 |
49 | A project (.NET SDK Style Project) for a single page C# (Modern .NET) XAML
50 | Islands app with Mile.Xaml Native Backend and no predefined layout.
51 |
52 | #### [MileXamlControlsDemoNetCore](MileXamlControlsDemoNetCore)
53 |
54 | A project (.NET SDK Style Project) for a single page C# (Modern .NET) XAML
55 | Islands app with Mile.Xaml with modernized Windows 11 style XAML controls.
56 |
--------------------------------------------------------------------------------