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
1080
CheckEditorImageAndTextButtonUIElement
posted

Hello,

I am trying to put text to be horizontal in UltraCheckEditor (button style), but i cannot get CheckEditorImageAndTextButtonUIElement, so i can set Multiline property. Can you just tell me what's missing in my code.

public class MultiLineCheckEditorCreationFilter : IUIElementCreationFilter
    {
        #region IUIElementCreationFilter Members

        void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
        {
            UltraCheckControlUIElement element = parent as UltraCheckControlUIElement;
            if (element != null)
            {
                EmbeddableCheckUIElement  check = element.ChildElements[0 as EmbeddableCheckUIElement ];
            

/// This is where i stopped, check has no ChildElements when you cast it.
                CheckEditorImageAndTextButtonUIElement textUIElement = check as CheckEditorImageAndTextButtonUIElement;
                   if (textUIElement != null)
               {
                      textUIElement.MultiLine = true;
                  }
            }
        }

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

Thanks,

Ivan

Parents
No Data
Reply
  • 469350
    Offline posted

    Hi Ivan, 

    I'm confused. What are you trying to achieve here? 
    UltraCheckEditor already displays the text horizontally (in every style) and already wraps the text to multiple lines if it does fit. 

    So I'm guessing that you want to set the text to something with NewLines in it so you can control where the wrapping occurs? If that's what you want, you can do this: 

        class MultiLineCheckEditorCreationFilter : IUIElementCreationFilter
        {
            public void AfterCreateChildElements(UIElement parent)
            {
                var textUIElementBase = parent as TextUIElementBase;
                if (null != textUIElementBase)
                {
                    textUIElementBase.MultiLine = true;
                }
            }
    
            public bool BeforeCreateChildElements(UIElement parent)
            {
                return false;
            }
        }

Children