We have UI requirements for our app that stated the background of a control needs to change color based on if the control is required, recommended, or optional. If a field is required with the default invalid state, it has one color, if any other invalid state it is another color, and if it is valid, a third color. for the recommended controls, they are one color when default invalid state, another when valid.
I am trying to figure out if there is a way I can use AppStyling and UltraWinValidator to make implementation of this easier or if I am going to have to code everything by hand.
I am also wondering if there is some way to use the UltraWinValidator to enable/disable the OK button.
Sam
Thank you!
Hi Sam,
Just about all your guesses here were correct. So you really didn't need me. :)
But I understand that a code snippet is worth a thousand words, so I updated your sample and I am attaching it here.
You will need to change the StyleManager.Load call to point to the correct folder.
Attached is a nice little code sample for you to fill in. It has a basic style applied to it that has 5 resources. the dialog has three buttons, Default, Critical, and Required. The events are not filled in yet because I don't know how to actually implement applying the resources to the UtraWinTextEditor.
If you would be so kind as to show me what I need to do in each event to change the appearance from the stock "default" to "Critical" to "Required", I would much appreciate it!
Mike,
Like always, I understand the concept of what you are saying, but I don't have a clue as to how to implement this concept.
FYI: Your replies with actual little code snippet/examples are always very, very useful and welcome!
It looks like WinValidator may not do what you want, but you may be able to use AppStylist. There's a property on the Appearance object called StyleResourceName. This property essentially allows you to map an Appearance property to a Resource in your application style library.
So what you could do is set up a resource in the StyleLibrary for each state you need. Then create an Appearance object in code and set the StyleResourceName to the name of the partilcular resource. Then you can assign that appearance to any object you want.
This doesn't help with the validation, of course, you still need to do that in code. But it would allow you to specify the colors you want for each state within the style library, rather than hard-coding it in your application.