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
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; } }
Hi Mike,
I didn't write in this forum for a few years, but you are still here
Yes, sorry i didn't explain better, yes, you are right, i need this text
V
I
D
E
O
ultraCheckEditor1.Text = "V" + Environment.NewLine + "I" + Environment.NewLine + "D" + Environment.NewLine + "E" + Environment.NewLine + "O";
I already tried this code, i found it in some previous post, and it's working if Style of editor is CHECK, but problem is when Style of editor is BUTTON. This code is not working there. So what to do when style is Button???