Silverlight text box conditional style binding

I bind an int to a text field. Is there a way to change the color of the text box based on the bound value?

For example, if int if> 0, the text field should be green, otherwise, red.

+3
source share
2 answers

Here you should use Value Converters, one of which converts from int to color. Then you bind the background property to the int property (and also bind the text).

Here's a post about them. So what does a Silverlight value converter mean?

+3
source

If you need to get complicated and use the appropriate styles, try this .

0
source

Source: https://habr.com/ru/post/1794606/


All Articles