E
E
ErickSkrauch2015-06-04 22:48:56
WPF
ErickSkrauch, 2015-06-04 22:48:56

How to change hover style in Metro UI?

There is a class that inherits Button and adds additional logic to the button according to the tasks of the application. No matter how much I struggled, it seems that the OnPointerEntered event fires before some magical hidden event that overrides the mapping of my colors to the colors from the theme.
Actually, the question is, how can I teach the button to change color from the C # code the way I want, and not globally written in the theme?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
S
Stanislav Agafonov, 2015-06-05
@ErickSkrauch

The question boiled down to: "How can I access a static property from XAML in code."
To do this, in app.xaml a class with a static property is added to the resources:
And in the right place it is accessed, for example like this:

Background="{Binding Instance.Color, Source={StaticResource Foo}}"

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question