Animation
values have the highest priority and even override local values.Border
has a Red background normally and Blue when the pointer is over it. This is because as with CSS more specific selectors have precedence. It is an issue, when you want to override default styles of any state (pointerover, pressed or others) with a single style. To achieve it you will need to have new styles for these states as well.Button
to be red by default and blue when pointer is over it. In fact, only setter of first style will be applied, and second one will be ignored.ContentPresenter
, which in the default is bound to the Buttons Background
property. However in the pointer-over state the selector is directly applying the backgroun to the ContentPresenter (Button:pointerover /template/ ContentPresenter#PART_ContentPresenter
) That's why when our setter was ignored in the previous code example. The corrected code should target content presenter directly as well:Background
property directly instead of changing theButton.Background
property?