我正在嘗試構建一個使用 XP Media Center 的 Royale 主題的 WPF 應用程式。我已經正確地將PresentationFramework.RoyaleDLL 和相應的 XAML 資源參考到我的App.xaml.

但是,視窗本身沒有,并且 WindowChrome/標題欄/視窗邊框主題無法同步,仍然是 Windows 10 的標準演示樣式。當然,這就是我試圖復制的內容,至少在視覺上是這樣:

相關 XAML,如果有用(所有*.cs檔案都是默認的):
App.xaml:
<Application x:Class="ExampleRoyale.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:Ariadne"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="/PresentationFramework.Royale;component/themes/Royale.NormalColor.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
MainWindow.xaml:
<Window x:Class="ExampleRoyale.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:ExampleRoyale"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<Button Content="Button" HorizontalAlignment="Left" Margin="94,39,0,0" VerticalAlignment="Top" Width="120"/>
<ComboBox HorizontalAlignment="Left" Margin="94,12,0,0" VerticalAlignment="Top" Width="120"/>
<Label Content="Label" HorizontalAlignment="Left" Margin="10,10,0,0" VerticalAlignment="Top" Width="79"/>
<Label Content="Label 2" HorizontalAlignment="Left" Margin="10,39,0,0" VerticalAlignment="Top" Width="79"/>
<RadioButton Content="RadioButton" HorizontalAlignment="Left" Margin="228,15,0,0" VerticalAlignment="Top" Width="102"/>
<RadioButton Content="RadioButton 2" HorizontalAlignment="Left" Margin="228,44,0,0" VerticalAlignment="Top" Width="102"/>
<TabControl Margin="82,72,82,71">
<TabItem Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
<TabItem Header="TabItem">
<Grid Background="#FFE5E5E5"/>
</TabItem>
</TabControl>
</Grid>
</Window>
有沒有辦法將 Royale 主題應用于視窗容器本身,或者 Royale 控制元件是我能得到的最接近的?
uj5u.com熱心網友回復:
有沒有辦法將 Royale 主題應用于視窗容器本身
不幸的是(?)視窗容器本身不是 WPF 的一部分,因此沒有自定義樣式。它是作業系統的一部分。
您可以通過以用戶身份更改作業系統設定(我沒有嘗試過)使 Windows 10 看起來像 Vista,但這與 WPF 無關。
轉載請註明出處,本文鏈接:https://www.uj5u.com/caozuo/424218.html
