You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[any-plat] DependencyProperty changed callback not firing when set via style setter #3398
kind/bugSomething isn't workingplatform/android 🤖Categorizes an issue or PR as relevant to the Android platformplatform/ios 🍎Categorizes an issue or PR as relevant to the iOS platformplatform/wasm 🌐Categorizes an issue or PR as relevant to the WebAssembly platformproject/styling 👔Categorizes an issue or PR as relevant to element styling
changed the title [-][any-plat] dp changed callback not firing when set via style setter[/-][+][any-plat] DependencyProperty changed callback not firing when set via style setter[/+]on Jun 18, 2020
Actually the callback is getting fired, but the Content property is not being updated... I suspect this is a problem with DP precedence being overridden while styles are being applied
And actually the precedence limitation was present on 2.4.
The difference after the Styles update is that the styled property is now applied after the unstyled property (correctly, this is what UWP does). Formerly the styled property was applied first.
So in this method:
private void AddLine(string text)
{
Content = string.IsNullOrEmpty(Content?.ToString())
? text
: Content + "\n" + text;
}
On 2.4, OnProperty2Changed sets Content at ExplicitStyle precedence, then OnProperty1Changed appends to it at Local precedence.
On 3.0.0-dev.593, OnProperty1Changed sets Content at Local precedence, then OnProperty2Changed appends to it at ExplicitStyle precedence. However the appended value is masked because it's at a lower precedence.
kind/bugSomething isn't workingplatform/android 🤖Categorizes an issue or PR as relevant to the Android platformplatform/ios 🍎Categorizes an issue or PR as relevant to the iOS platformplatform/wasm 🌐Categorizes an issue or PR as relevant to the WebAssembly platformproject/styling 👔Categorizes an issue or PR as relevant to element styling
Activity
Xiaoy312 commentedon Jun 18, 2020
TestControl:
Xaml:
[-][any-plat] dp changed callback not firing when set via style setter[/-][+][any-plat] DependencyProperty changed callback not firing when set via style setter[/+]davidjohnoliver commentedon Jun 18, 2020
Actually the callback is getting fired, but the
Contentproperty is not being updated... I suspect this is a problem with DP precedence being overridden while styles are being applieddavidjohnoliver commentedon Jun 18, 2020
And actually the precedence limitation was present on 2.4.
The difference after the Styles update is that the styled property is now applied after the unstyled property (correctly, this is what UWP does). Formerly the styled property was applied first.
So in this method:
private void AddLine(string text)
{
Content = string.IsNullOrEmpty(Content?.ToString())
? text
: Content + "\n" + text;
}
On 2.4,
OnProperty2ChangedsetsContentatExplicitStyleprecedence, thenOnProperty1Changedappends to it atLocalprecedence.On 3.0.0-dev.593,
OnProperty1ChangedsetsContentatLocalprecedence, thenOnProperty2Changedappends to it atExplicitStyleprecedence. However the appended value is masked because it's at a lower precedence.dr1rrb commentedon Jun 19, 2020
This issue is also certainly causing the issue described here : #190 (comment)
If we set the
Template = DisplayTemplateit should override the template defined in the style.