dotnet / wpf

WPF is a .NET Core UI framework for building Windows desktop applications.
MIT License
6.84k stars 1.13k forks source link

Style doesn't work for controls that were defined inside DataTemplate #9029

Open SubashiniMahendran opened 1 month ago

SubashiniMahendran commented 1 month ago

Description

In our application, we have customized the style of Hyperlink and TextBlock and merged it to Window resources. But, respective style not apply for the hyperlink and textblock controls that were defined inside the DataTemplate.

image

But suppose if we merge the resource dictionary in Application resources. It works fine. image

Reproduction Steps

  1. Note, we have merged resource dictionary in Windows.Resources.
  2. Run the sample.
  3. Note, Hyperlink and TextBlock style not applied.

Style-issue.zip

Expected behavior

Style should work for controls that were defined inside DataTemplate

Actual behavior

Style doesn't work for controls that were defined inside DataTemplate

Regression?

No response

Known Workarounds

No response

Impact

No response

Configuration

No response

Other information

No response