Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
625
Grid performance - appearance initialization
posted

We are initializing the appearance for an editor control that we are using like this:

    internal class HiddenLinkFormattedTextEditor : UltraFormattedTextEditor
    {
        internal HiddenLinkFormattedTextEditor()
        {
            var foreColor = Color.FromArgb(0xFF, 0x38, 0x43, 0x50); // DarkNavy

            this.ActiveLinkAppearance.ForeColor = foreColor;
            this.ActiveLinkAppearance.Cursor = Cursors.Arrow;

            this.LinkAppearance.ForeColor = foreColor;
            this.LinkAppearance.Cursor = Cursors.Arrow;

            this.HotTrackLinkAppearance.ForeColor = foreColor;
            this.HotTrackLinkAppearance.Cursor = Cursors.Arrow;

            this.VisitedLinkAppearance.ForeColor = foreColor;
            this.VisitedLinkAppearance.Cursor = Cursors.Arrow;

            this.VisitedLinksManager = null;

            this.UnderlineLinks = UnderlineLink.Never;
        }

In the performance profiler I see that the appearance calls are translated to 4 calls to Infragistics.Win.Appearance.set_ForeColor (obviously a static property) which takes about 1 second during startup of our application (probably because there are already a couple of instantiated and bound grids where this property then gets re-applied).

Is there a better way to do this? Since these are static properties - do I need to introduce my own marker variable that I set when I have gone through this initialization once (even if it looks like it is setting instance properties)?

Any other suggestions for optimizing performance for this initialization?

Please note: this particular method seems to have gotten slower compared to the pretty ancient version (IG 2011) that we have been using until recently.