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
30
Newline in UltraCheckEditor
posted

Hi there,

I have a list of UltraCheckEditor controls set to EditCheckStyle.Custom , and am setting the text of these controls in code. I'm using Environment.NewLine to build the text, but nothing shows up after the first line.

Is what I'm trying to do possible, and if it is how do I go about making this work?

Parents
No Data
Reply
  • 469350
    Suggested Answer
    Offline posted

    Hi,

    UltraCheckEditor doesn't have any built-in support for multi-line text. But I was about to find a pretty simple workaround for you using a CreationFilter. All you have to do is tell the TextUIElement in the UltraCheckeditor to support multiline. So here's a little sample CreationFilter. You could create one instance of this class and attach it to any number of UltraCheckEditor controls and it watches for the creation of the TextUIElement and sets Multiline to true.


            private MultiLineCheckEditorCreationFilter multiLineCheckEditorCreationFilter = new MultiLineCheckEditorCreationFilter();
            private void Form1_Load(object sender, EventArgs e)
            {
                this.ultraCheckEditor1.CreationFilter = multiLineCheckEditorCreationFilter;
                this.ultraCheckEditor1.Text = "Line 1" + Environment.NewLine + "Line 2";
            }

            public class MultiLineCheckEditorCreationFilter : IUIElementCreationFilter
            {
                #region IUIElementCreationFilter Members

                void IUIElementCreationFilter.AfterCreateChildElements(UIElement parent)
                {
                    TextUIElement textUIElement = parent as TextUIElement;
                    if (textUIElement != null)
                    {
                        textUIElement.MultiLine = true;
                    }
                }

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

                #endregion
            }

Children