Implicit style lookup not working correctly when control is part of a template
- Dominant language
- C#
- Stars
- 7.7k
- Forks
- 1.3k
- Avg merge
- 1d 11h
- Merged PRs (30d)
- 61
Description
### Description
Implicit style lookup not working correctly when control is part of a template.
That's because `FindImplicitStyleResource` sets a `boundaryElement` which causes implicit style lookup to bubble up to the `ContentPresenter` and immediately skip to App- and Theme-Resources.
There is a comment in the code stating:
> // For non-controls the implicit StyleResource lookup must stop at
// the templated parent. Look at task 25606 for further details.
I have no clue what's inside task 25606, but if that code there is really required the details should be added to the comment.
### Reproduction Steps
See repro
[StyleLookup.zip](https://github.com/dotnet/wpf/files/14468291/StyleLookup.zip)
### Expected behavior
Both TextBlock elements should have a green foreground.
### Actual behavior
The TextBlock generated by the ContentPresenter has a red foreground.
Regular TextBlock has a green foreground.
### Regression?
No
### Known Workarounds
A workaround will be shown in the commits fixing https://github.com/snoopwpf/snoopwpf/issues/397
But such workaround is not suitable for regular applications i think.
### Impact
_No response_
### Configuration
_No response_
### Other information
_No response_
Contributor guide
Assessment
This issue has not been assessed yet.