先日 WinForms のダークモードについてイベントで話をしてきました。
その際、確認できていなかったのですが Preview 4 で WPF のダークモード対応の情報に気が付いてしまったので試してみます。
話してきた内容
WPF のダークモード
試してみます
■ WinForms
以前は書けなかった、将来書けるかもしれないダークモードに関するコードです。
エラー! 残念。
■ WPF
App.xaml を書き換え
<Application x:Class="D4WPF.App" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:local="clr-namespace:D4WPF" StartupUri="MainWindow.xaml"> <Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/PresentationFramework.Fluent;component/Resources/Fluent.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources> </Application>
確かに! ダークモード対応です。
でも
でもコードの中で現在のモードや色は取れないみたいです。むしろそっちが欲しい