I want to auto resize UltraFormattedTextEditor to fit its content
(do not show horizontal scrolbar)
Is it a way to determine when scrollbar is shown? (than I can enlarge control till scrollbars hide)
PS I tried also tip from http://news.infragistics.com/forums/p/9870/38062.aspx#38062 but doesnt help
You could do something like this by calling the GetDescendant method off the control's UIElement, passing in typeof(ScrollBarUIElement), but I would advise against this for performance reasons.
The UltraFormattedTextEditor control utilizes the FormattedLinkEditor embeddable editor, and classes that derive from EmbeddableEditorBase (as FormattedLinkEditor does) expose a GetSize method, which I believe will give you the size required to render the value. You can get a reference to the editor by calling GetDescendant off the control's UIElement, passing in typeof(FormattedLinkEmbeddableUIElement). The UIElement returned exposes an Editor property, which exposes a GetSize method. One of those overloads takes the maxWidth, to which you should pass the control's width minus borders. You might have to fudge the value a little to make sure no scrollbars appear but I think this approach would be more performant than increasing the size until the scrollbars disappear.
Can you please give an example how can I get info when scrollbars visible or not?
I cannot see any value in sbElement variable saying if scroolbar is already displayed or not
ScrollBarUIElement sbElement = (ScrollBarUIElement) ufteMain.UIElement.GetDescendant (typeof(ScrollBarUIElement));