Extended WPF Toolkit RichTextBox display text vertically

こ雲淡風輕ζ 提交于 2019-12-07 16:06:59

问题


I'm trying to bind a rich content (RTF format) to a rich text box (of Extended WPF Toolkit) via its Text property like this

<extToolkit:RichTextBox x:Name="rtbKIContent" Margin="8,8,8,8" 
                                    IsEnabled="{Binding IsEditable}"
                                    Text="{Binding Content}">
                <extToolkit:RichTextBox.TextFormatter>
                    <extToolkit:RtfFormatter></extToolkit:RtfFormatter>

                </extToolkit:RichTextBox.TextFormatter>
                <extToolkit:RichTextBoxFormatBarManager.FormatBar>
                    <extToolkit:RichTextBoxFormatBar />
                </extToolkit:RichTextBoxFormatBarManager.FormatBar>
</extToolkit:RichTextBox>

Sometimes it works just fine, but there are circumstances that they just display the text vertically like this.

I don't know what's wrong with it...What should I do to make it display text from left to right like normal?


回答1:


If you add a width to the RichTextBox, it should fix it.

I did this so it binds to the parent.

Width="{Binding RelativeSource={RelativeSource FindAncestor, AncestorType=Grid, AncestorLevel=1}, Path=ActualWidth}"

Note you will have to determine AncestorType for you. But you can do this too. Width="100"




回答2:


Agree with "jmogera". Need to set width for this issue.

HorizontalAlignment="Stretch" MinWidth="100"

You can set MinWidth to 100 and keep HorizontalAlign to streach if you want control to resize.



来源:https://stackoverflow.com/questions/9679353/extended-wpf-toolkit-richtextbox-display-text-vertically

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!