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
63
ComboBoxTool Style in RibbonGroup
posted

Thank in advance.

I added ComboBoxTool with Image in a Ribbon Group .

But I want ComboBoxTool to be placed below Image like normal ButtonTool with Large Image.

or ComboBoxTool and Text (Caption) below it.

What Can I do?

 

Parents
  • 6158
    Suggested Answer
    Offline posted

    Hello,

    Unfortunately there is no property to specify the location of the edit area relative to the Image for a Tool on the RibbonGroup. To accomplish something of this nature, you will have to use a CreationFilter to reposition the UIElements.

    You can probably use one similar to the following (but may have to change the calculated rectangles should you want to change the way the elements are displayed):

     

        public class ToolCreationFilter : Infragistics.Win.IUIElementCreationFilter
        {
            #region IUIElementCreationFilter Members
    
            public void AfterCreateChildElements(Infragistics.Win.UIElement parent)
            {
                if (parent is Infragistics.Win.UltraWinToolbars.EditorToolBaseUIElement)
                {
                    Rectangle workRect = parent.RectInsideBorders;
    
                    UIElement captionElement = null;
                    UIElement imageElement = null;
                    UIElement editAreaElement = null;
    
                    foreach (UIElement childElement in parent.ChildElements)
                    {
                        if (childElement is ImageUIElement)
                        {
                            imageElement = childElement;
                            continue;
                        }
    
                        if (childElement is ToolEditorAreaUIElement)
                        {
                            editAreaElement = childElement;
                            continue;
                        }
    
                        if (childElement is TextUIElement)
                        {
                            captionElement = childElement;
                            continue;
                        }
                    }
    
                    if (editAreaElement != null)
                    {
                        Rectangle childRect = workRect;
                        childRect.Y = childRect.Bottom - 20;
                        childRect.Height = 20;
                        editAreaElement.Rect = childRect;
                        workRect.Height -= 20;
                    }
    
                    if (captionElement != null)
                    {
                        Rectangle childRect = workRect;
                        childRect.Y = childRect.Bottom - 20;
                        childRect.Height = 20;
                        captionElement.Rect = childRect;
                        workRect.Height -= 20;
                    }
    
                    if (imageElement != null)
                    {
                        imageElement.Rect = workRect;
                    }
                }
            }
    
            public bool BeforeCreateChildElements(Infragistics.Win.UIElement parent)
            {
                return false;
            }
    
            #endregion
        }
    

     

     

    Note that by specifying the Width of the Tool and removing the Caption, the preceding CreationFilter modified a ComboBoxTool to look like:

    Hopefully this helps meet your needs. Let me know if I can be of further assistance.

    Thanks,

    Chris

Reply Children
No Data