[英]How can I interpret my string content in WPF control?
我有一个带有 xaml 代码的string
,我想知道如何将此内容绑定到TextBlock
或Label
等控件。
我的字符串值是这样的:
<FlowDocument xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:markdig="clr-namespace:Markdig.Wpf;assembly=Markdig.Wpf" Style="{StaticResource {x:Static markdig:Styles.DocumentStyleKey}}">
<Paragraph Style="{StaticResource {x:Static markdig:Styles.Heading1StyleKey}}">
<Run Text="Changelog" />
</Paragraph>
<Paragraph>
<Run Text="All notable changes to this project will be documented in this file." />
</Paragraph>
该程序正在返回我向您展示的内容。
我希望有一个人可以帮助我。 也许我只是不知道如何在谷歌上解释我的问题
我将我的字符串转换为 Stream
byte[] byteArray = Encoding.ASCII.GetBytes(ChangelogContent);
MemoryStream stream = new MemoryStream(byteArray);
scrollView.Content = XamlReader.Load(stream);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.