我的程序调用Java,然后将stdout重定向到a RichTextBox.我的问题是,每次写入数据时,垂直滚动条始终位于框的顶部.
即使您滚动到底部,一旦写入新数据,它就会转到顶部.我想反其道而行之.
因此,当写入新数据时,它会保持在底部.我怎样才能做到这一点?
我在VS 2013中创建了一个WPF项目.升级到VS 2015后,设计器中显示的错误来自Blend SDK:
程序集中的类型是使用旧版本的blend sdk构建的,并且在windows presentation foundation 4项目中不受支持
我有一个 WPF 用户控件,其中包含BindableRichTextBox:
xmlns:controls="clr-namespace:SysadminsLV.WPF.OfficeTheme.Controls;assembly=Wpf.OfficeTheme"
.
.
.
<controls:BindableRichTextBox Background="Black"
Foreground="White"
FontFamily="Consolas"
FontSize="12"
IsReadOnly="True"
IsReadOnlyCaretVisible="True"
VerticalScrollBarVisibility="Auto"
IsUndoEnabled="False"
Document="{Binding Contents}"/>
Run Code Online (Sandbox Code Playgroud)
内容由 ViewModel 属性控制Document:
using System.Windows.Documents;
class MyViewModel : ILogServerContract
{
readonly Paragraph _paragraph;
public MyViewModel()
{
_paragraph = new Paragraph();
Contents = new FlowDocument(_paragraph);
}
public FlowDocument Contents { get; }
//Log Server Contract Write method (accessed via NetPipe)
public void WriteLine(string text, int debugLevel)
{
//figure out formatting stuff based on debug level. not important
_paragraph.Inlines.Add(new Run(text) …Run Code Online (Sandbox Code Playgroud)