【问题标题】:Silverlight: Scroll issue with RichTextBox Selection propertySilverlight:RichTextBox 选择属性的滚动问题
【发布时间】:2013-09-07 01:39:11
【问题描述】:

我在 silverlight 中有一个 Grid,它有很多不同的控件。 在 Grid 的最后一行,我有一个 RichTextBox。

要在 RichTextBox 中写一些东西,首先我们必须向下滚动到那里,因为控件太多了。

每次我们打开该网格时,所有控件都会使用一些初始数据启动。 现在这条线有问题

this.rtb.Selection.Text = "Initial Text";

这一行的作用是将文本设置到 RichTextBox 控件中并设置焦点,结果我的滚动条移到了底部,这很烦人。

我希望将此文本分配给它,但滚动条应保持在顶部。

【问题讨论】:

    标签: silverlight scroll richtextbox selection


    【解决方案1】:

    试试这个:

    // create a paragraph
    Paragraph prgParagraph = new Paragraph();
    
    // create some text, and add it to the paragraph
    Run rnMyText = new Run();
    rnMyText.Text = "This is some example text with a ";
    
    prgParagraph.Inlines.Add(rnMyText);
    
    // add the paragraph to the RTB
    rbtMyRichTextBox.Blocks.Add(prgParagraph);
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2014-03-06
      • 2013-07-28
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多