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
171
UltraFormattedTextEditor.ScrollBarDisplayStyle to only show vertical scrollbar
posted

The UltraFormattedTextEditor has the property ScrollBarDisplayStyle. This property can be set with an enumerator, and the options in the enumerator are: Automatic, Always and Never. Is there a way for me to set the Vertical scrollbar to be Automatic and the horizontal scrollbar to Never show?

Parents
  • 37774
    Verified Answer
    posted

    There's nothing exposed publically that would allow you to do this, but if your application will have reflection permissions, you could hack this with a CreationFilter:

    public class CF : IUIElementCreationFilter
    {
        public void AfterCreateChildElements(UIElement parent)
        {
            if (parent is FormattedLinkEmbeddableUIElement)
            {
                ScrollableAreaUIElement scrollElement = parent.GetDescendant(typeof(ScrollableAreaUIElement)) as ScrollableAreaUIElement;
                if (scrollElement != null)
                {
                    PropertyInfo info = typeof(ScrollableAreaUIElement).GetProperty("HorizScrollbarVisible", BindingFlags.NonPublic | BindingFlags.Instance);
                    if (info != null)
                        info.SetValue(scrollElement, false, null);
                }
            }
        }

        public bool BeforeCreateChildElements(UIElement parent)
        {
            return false;
        }
    }

    this.ultraFormattedTextEditor1.CreationFilter = new CF();

    -Matt

Reply Children
No Data