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
315
Checkbox in
posted
Under UltraToolBarManager, needs to add a checkbox on the toolbar. So, i've added StateButtonTool  by setting ToolbarDisplayStyle to Glyph.  It displays Checkbox.
And this newly added checkbox, I want to show checkbox icon at right hand side instead of default left side. We could achieve the same for windows Checkbox or radiobutton tool by setting the "RightToLeft" property to "Yes"
So can we acheive this for StateButtonTool ? How to fulfill this requirement.
I need the checkbox icon RHS on toolbar and then checkbox text. 
Thanks
Pramod Pawar
Parents
  • 469350
    Offline posted

    Hi Pramod,

    There's no property for this, but you can do it using a CreationFilter to switch the positions of the CheckIndicator and the ImageAndText elements.

                this.ultraToolbarsManager1.CreationFilter = new MyCreationFilter();


        public class MyCreationFilter : IUIElementCreationFilter
        {
            #region IUIElementCreationFilter Members

            void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
            {
                if (string.Compare(parent.GetType().Name, "GlyphToolUIElement") == 0)
                {
                    UIElement checkIndicatorElement = parent.GetDescendant(typeof(CheckIndicatorUIElement));
                    UIElement imageAndTextUIElement = parent.GetDescendant(typeof(ImageAndTextUIElementEx));

                    if (checkIndicatorElement == null ||
                        imageAndTextUIElement == null)
                    {
                        return;
                    }

                    // Position the image and text element to the X coordinate where the
                    // check indicator is (on the left).
                    imageAndTextUIElement.Rect = new Rectangle(
                        checkIndicatorElement.Rect.X,
                        imageAndTextUIElement.Rect.Y,
                        imageAndTextUIElement.Rect.Width,
                        imageAndTextUIElement.Rect.Height);

                    // Position the check indicator to the right of the imageAndTextUIElement.
                    checkIndicatorElement.Rect = new Rectangle(
                        imageAndTextUIElement.Rect.Right,
                        checkIndicatorElement.Rect.Y,
                        checkIndicatorElement.Rect.Width,
                        checkIndicatorElement.Rect.Height);
                }
            }

            bool IUIElementCreationFilter.BeforeCreateChildElements(UIElement parent)
            {
                // Do nothing
                return false;
            }

            #endregion
        }

Reply Children