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
155
Change Expander Button Icon ??
posted

We need to change the expander icon to a bitmap of our choice for both directions.  Is there a way to do this?

 

Thanks,

 

  • 25
    Offline posted

    Use a creation filter on the explorerbar.

    namespace Sample
    {
        #region Usings

        using System.Linq;

        using Infragistics.Win;
        using Infragistics.Win.UltraWinExplorerBar;

        #endregion

        public class ExplorerBarCreationFilter : IUIElementCreationFilter
        {
            #region Methods

            public void AfterCreateChildElements(UIElement parent)
            {
                var expansionButton = parent as NavigationPaneExpansionButtonUIElement;
                if (expansionButton == null)
                {
                    return;
                }

                var children = expansionButton.ChildElements;
                var imageUIElement = children.OfType<ImageUIElement>().FirstOrDefault();
                if (imageUIElement == null)
                {
                    return;
                }

                var image = expansionButton.Expanded
        ? images.chevron_right
        : images.chevron_left;

                imageUIElement.Image = image;
            }

            public bool BeforeCreateChildElements(UIElement parent)
            {
                return false;
            }

            #endregion
        }
    }

    kind regards,

    Marcel