wpf - Text Viewer
You might need to present some document or embed some readable content to the Reader. More often than not the information will be in text format, and we might want to have the ability to allow user to scroll either vertically or horizontally;
For one, if you have some fixed source (from File or some other persited source), you might give a try to the DocumentViewer, which has a Document property (which can host a FixedDocument or a XpsDocument).
Or for some simpler use case, you just want to have such a View port of the text, and the Text does not requires such complex treatment such as pagination or else, you can embed a textBox inside a ScrollViewer, which has the scrollbar (horizontally and the Vertically) built-in, here is one paradigm to use the this pattern:
<ScrollViewer Grid.Column="2" Grid.Row="0"
HorizontalScrollBarVisibility="Auto" VerticalScrollBarVisibility="Auto"
x:Name="Scroller"
>
<TextBox x:Name="txtTemplate"
HorizontalAlignment="Stretch" VerticalAlignment="Stretch"
MinWidth="100" Width="{Binding ElementName=Scroller, Path=ViewportWidth}" TextWrapping="Wrap"
/>
</ScrollViewer>
there are other Viewer, such as ViewBox (which seems too pristine?) Check more information in the comment below.
<!-- ViewBox ??-->
<!-- DocumentViewer ??-->
<!--http://*.com/questions/1981137/c-sharp-wpf-scrollviewer-textblock-troubles-->
转载于:https://my.oschina.net/u/854138/blog/130767
上一篇: Reflection 反射
推荐阅读
-
JQuery中的html()、text()、val()区别示例介绍
-
sql中char/nchar/varchar/nvarchar/text/ntext之间的区别
-
DotNetCore 3.0 助力 WPF本地化
-
Word Viewer2003(简体中文版)下载
-
sublime text3格式化html,css,js代码
-
重置sqlserver2000 text长度 博客分类: sqlserver@数据库 SQL Server 2000text
-
ubuntu下使用sublime text时如何完美输入中文
-
WPF与Spring 博客分类: 编程技术 WPFSpring
-
WPF与Spring 博客分类: 编程技术 WPFSpring
-
WPF与Miplatform的共同点 博客分类: 编程技术 WPF浏览器脚本.netXML