microsoft / microsoft/WPF-Samples
Can't use resources/ styles set in App.xaml.cs in a WPF page (System.Windows.Controls.Page)
Nobody has claimed this yet.
- Dominant language
- C#
- Stars
- 5.7k
- Forks
- 3.3k
- Avg merge
- 12d 8h
- Merged PRs (30d)
- 2
Description
This works in a WPF window (System.Windows.Window):
<TextBlock Text="This is a Fluent styled TextBlock" Style="{StaticResource CaptionTextBlockStyle}" />
but, not in a WPF page (System.Windows.Controls.Page)
In both cases my App.xaml.cs has the following markup:
<Application.Resources> <ResourceDictionary> <ResourceDictionary.MergedDictionaries> <ResourceDictionary Source="pack://application:,,,/PresentationFramework.Fluent;component/Themes/Fluent.xaml" /> </ResourceDictionary.MergedDictionaries> </ResourceDictionary> </Application.Resources>
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Application.Resources markup in App.xaml.cs and compare how CaptionTextBlockStyle is resolved in a WPF Window versus a System.Windows.Controls.Page. Reproduce the StaticResource lookup using the Fluent.xaml merged dictionary; done when the style resolves correctly in the Page as well as the Window.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- csharp
- Domain
- desktop
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 35/100