Hi there!
I've created a custom control to visualise some data. I want my control to take on the appearance of the Infragistics controls in my app.
These controls are styled at runtime using an .isl file.
How can I determine for example what the border of an UltraTextEditor control is at runtime, as its Appearance doesn't seem to contain this info!
Cheers,
James
Hello James,
What does your custom control derive from? If it derives from TextBox or anther inbox control then you can use the InboxControlStyler component found in the toolbox in VS to enable styling on your custom control without deriving from an Infragistics control. Styling options set in AppStylist will be applied to the custom control. Let me know if you have any questions regarding this matter.
Hi Michael,
That really doesn't work for me... I don't want any of the text editor's functionality... I just want to grab it's background color and border color and use them in my own custom paint event.
I don't want any editing features, I don't want a whole load of properties exposed to the designers.
And even then, I tried the approach, and my controls didn't get styled anyway!
We strongly recommend that your custom control is derived from UltraTextEditor to match the appearance of your application.
public partial class CustomControl1 : UltraTextEditor { public CustomControl1() { InitializeComponent(); } protected override void OnPaint(PaintEventArgs pe) { base.OnPaint(pe); } }
public partial class CustomControl1 : UltraTextEditor
{ public CustomControl1() { InitializeComponent();
} protected override void OnPaint(PaintEventArgs pe)
{ base.OnPaint(pe);
}
Mike Saltzman said: Hi James, The appearance resolution process is actually quite complicated. The UltraTextEditor considers many factors: the Application style library, it's own appearances, and it's current state (edit mode, hottracking, etc.). So getting the colors for every possible state really isn't practical. If you just want to get the basic color, then what I would do is place an UltraTextEditor on the form (or use one that is already on the form, if you already have one). Then you can use the ResolveAppearance method to get the resolved appearance for the control in the normal state: AppearanceData appearanceData = new AppearanceData(); AppearancePropFlags appearancePropFlags = AppearancePropFlags.AllRender; this.ultraTextEditor1.ResolveAppearance(ref appearanceData, ref appearancePropFlags); There's no way to get the state-specific appearances, though. So you won't be able to get the HotTracking appearance, for example, unless you call the ResolveAppearance method while the control is currently HotTracked, which would be very difficult, if not impossible.
Hi James,
The appearance resolution process is actually quite complicated. The UltraTextEditor considers many factors: the Application style library, it's own appearances, and it's current state (edit mode, hottracking, etc.).
So getting the colors for every possible state really isn't practical.
If you just want to get the basic color, then what I would do is place an UltraTextEditor on the form (or use one that is already on the form, if you already have one). Then you can use the ResolveAppearance method to get the resolved appearance for the control in the normal state:
AppearanceData appearanceData = new AppearanceData(); AppearancePropFlags appearancePropFlags = AppearancePropFlags.AllRender; this.ultraTextEditor1.ResolveAppearance(ref appearanceData, ref appearancePropFlags);
There's no way to get the state-specific appearances, though. So you won't be able to get the HotTracking appearance, for example, unless you call the ResolveAppearance method while the control is currently HotTracked, which would be very difficult, if not impossible.
Hi Mike,
This looked promising for a while, but still doesn't see to work. perhaps I need to explain a bit more...
When I call ResolveAppearance on a text editor, I get nothing back in BorderColor, BorderColor2, BackColor, BackColor2 etc.
All I get is SystemColors.Control for the BorderColor3DBase property, which certainly doesn't match what I can see on screen!!
BTW... I am using v12.1 of the controls (stuck with a corporate standard build that doesn't support .net 4.0)
Michael DiFilippo said: Hello James, Do you have 'UseAppStyling' set to false? Does your UltraTextEditor have a visible border or one applied at all to begin with? Are you asking how to set a border using an AppStyle isl? Can you please provide me with more information regarding your application and perhaps attach a screenshot? For instance, which properties do you have set on the texteditor, before attempting to style. In the meantime, please take a look at a couple forum posts that I have found and let me know if they help. http://es.infragistics.com/community/forums/t/16006.aspxhttp://es.infragistics.com/community/forums/t/5471.aspx
Do you have 'UseAppStyling' set to false? Does your UltraTextEditor have a visible border or one applied at all to begin with? Are you asking how to set a border using an AppStyle isl? Can you please provide me with more information regarding your application and perhaps attach a screenshot? For instance, which properties do you have set on the texteditor, before attempting to style.
In the meantime, please take a look at a couple forum posts that I have found and let me know if they help. http://es.infragistics.com/community/forums/t/16006.aspxhttp://es.infragistics.com/community/forums/t/5471.aspx
Sorry, but these posts don't help. I simply drop my controls on a form and let the app stylist do its thing.
What I want to be able to do, is "borrow" that styling in my custom control so that I can replicate the look and feel based on the current app style.
NB I allow users to select the current style at runtime.