簡體   English   中英

如何在 WPF 控件中解釋我的字符串內容?

[英]How can I interpret my string content in WPF control?

我有一個帶有 xaml 代碼的string ,我想知道如何將此內容綁定到TextBlockLabel等控件。

我的字符串值是這樣的:

<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.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM