Hi,
I am trying to set the backgound color of a UltraNumericEditor by setting the Appearance.StyleResourceName to a resource that has
the Border and background colors set to a red color to indicate a error condition.
I have the ResolutionOrder for the UltraNumericEditor set to ControlThenApplication in the AppStylist.
When I apply the style I see the border color applied to the control, but the background color is not set.
I use the same resource on UltraTextEditors and it works like I expect.
Is there something that I am missing?
Thanks
Hi Harlan,
When using the ControlThenApplication resolution order, the most likely reason that styling doesn't take effect is because the control applies some type of style and the ResolutionOrder is giving the control precedence. If there's any code in the control to set up a default background color, that would mean the Style doesn't get a chance to modify it. How does the editor look if you change the resolution order?
I'd also like to know a bit more about how you are using styling? What effect are you going for and why are you using ControlThenApplication? Please let me know.
I set the teh resolution order set to ControThenApplication so I can set the UltraNumeric Appearance.StyleResourceName pragmatically.
I am doing this as part of data validation. When we save the work space, we run validation on the values in the controls.
In this case a number is required in the control If there is no number, I set the Appearance.StyleResourceName.
We load the style set at the application start with a default style. We have the style set to give us a certain look in our application
In the case of the UltraNumericEditor, we do not have anything set in the AppStylist.
It is my understanding that I need to set the resolution order to ControlThenApplication so that I can set the resource pragmatically.
The only styling that the control sets in the application is just the Appearance.StyleResourceName. to show an error condition.
This is not working. I have the resource set to show a red background color and a red border. Only the red boarder is shown when I apply the resource.
OK,
I figured out what the problem was.
In the backing code of the designer, the control backcolor property was set to white. (NumericEditor.BackColor = System.Drawingl.Color.White)
This is strange, as that property is not shown in the designer except as a sub property of the appearance.
I made sure there was not backcolor set in the appearance, but I neglected to look at the InitializeCompoent method. I always assumed that the the InitializeComponent code
was an exact implementation of the designer properties.
Thanks for your help.
It's good to hear that you have this working.
I wanted to clear up one misconception you had about resolution order: When programmatically setting the appearance of an instance of an object, this will always take precedence over styling. The "Control" part of "ControlThenApplication" applies when setting general appearance properties such as the ActiveCellAppearance on the grid. In this example, setting the specific cell's appearance would take priority regardless of ResolutionOrder.
Is there anything further I can assist you with?