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
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 snoopwpf/snoopwpf#397
But such workaround is not suitable for regular applications i think.
Impact
No response
Configuration
No response
Other information
No response