Open
Description
Description
While using DatePicker
with ThemeMode set to System, the application crashes with the exception: System.Windows.Markup.XamlParseException: 'Provide value on 'System.Windows.Markup.StaticResourceHolder' threw an exception.'
Reproduction Steps
- Create a simple WPF application
- Set the ThemeMode of applications as System
- Include a simple DatePicker in MainWindow.xaml
- Launch the Application
<Window x:Class="SampleApplication.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SampleApplication"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<DatePicker Margin="8" />
</Grid>
</Window>
Expected behavior
Application should simple run with DatePicker rendered.
Actual behavior
Application crashes with the above mentioned exception.
Regression?
Yes
Known Workarounds
Instead of using ThemeMode as System, either use Light or Dark mode. Alternatively, to use system theme, include the Fluent.xaml directly in resourcedictionary.
In app.xaml include the following:
<Application x:Class="SampleApplication.App"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:local="clr-namespace:SampleApplication"
StartupUri="MainWindow.xaml">
<Application.Resources>
<ResourceDictionary>
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="pack://application:,,,/PresentationFramework.Fluent;component/Themes/Fluent.xaml" />
</ResourceDictionary.MergedDictionaries>
</ResourceDictionary>
</Application.Resources>
</Application>
Impact
No response
Configuration
.NET 10, preview 4
Windows 11
x64
Other information
No response
Metadata
Metadata
Assignees
Type
Projects
Status
No status