简体   繁体   English

扩展的WPF工具包RichTextBox Horizo​​ntalScrollBarVisibility问题

[英]Extended WPF Toolkit RichTextBox HorizontalScrollBarVisibility issue

when I am loading a text file to my window I am not getting horizontal ScrollBar at all any idea why ? 当我将文本文件加载到窗口时,我根本没有得到水平ScrollBar,为什么?

<UserControl x:Class="CAMXSimulator.View.LogView"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

             xmlns:toolkit="clr-namespace:Microsoft.Windows.Controls;assembly=WPFToolkit.Extended">


        <TabControl  
            AllowDrop="True"
            PreviewDragOver="DragOver"
            PreviewDrop="Drop"
            >
            <TabItem Header=" File">

            <toolkit:RichTextBox AcceptsReturn="True" 
                         AcceptsTab="True" 

                         BorderBrush="Black" 
                         BorderThickness="2" 
                         ScrollViewer.HorizontalScrollBarVisibility="Auto" 
                         Name="DisplaySFMFileContents" 
                         Text="{Binding Path=VManageLogFile}"
                         ScrollViewer.VerticalScrollBarVisibility="Auto"
                         >
                <toolkit:RichTextBox.TextFormatter>
                    <toolkit:PlainTextFormatter />
                </toolkit:RichTextBox.TextFormatter>
            </toolkit:RichTextBox>
        </TabItem>
        <TabItem Header=" Headers" /> 
    </TabControl>

</UserControl>

It just formats the lines to be as width of the window and not how they should be . 它只是将线条的格式设置为窗口的宽度,而不是窗口的宽度。 Any idea ? 任何想法 ?

You need to set the WordWrap = False in order for this to work properly. 您需要设置WordWrap = False才能正常工作。 Otherwise it will wrap the text and only show the Vertical scrollbar if needed. 否则,它将包装文本,并仅在需要时显示“垂直”滚动条。

In looking over the code in my text project, it looks like the WordWrap keyword might not be there. 在查看我的文本项目中的代码时,似乎没有WordWrap关键字。 However, to enable this functionality, you can set the Document.PageWidth = and it will prevent the text from wrapping. 但是,要启用此功能,可以设置Document.PageWidth =,这样可以防止文本换行。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM