私はこのXAMLを持っています:
<TextBlock TextWrapping="Wrap" Foreground="Green"
Text="This is some Green text up front. ">
<TextBlock Foreground="Blue">
This is some Blue text.
</TextBlock>
This is some Green text following the Blue text.
<Hyperlink>
<TextBlock Text="And finally, this is a Hyperlink." TextWrapping="Wrap"/>
</Hyperlink>
</TextBlock>
そして、C#で手続き的に複製する方法を知りたいです。
TextBlock次のようなものを使用して C# で sを作成する方法を知っています。
TextBlock tb = new TextBlock();
tb.Text="Some text"
TextBlockまた、C# 内のパネルに複数の をまとめることができます。TextBlockしかし、 s を他TextBlockの sに入れたり、 TextBlocks をHyperlinksに入れたりする方法がわかりませんTextBlock。
どういうわけか、いくつかのコンテナ オブジェクトと追加TextBlockオブジェクトが自動的に作成されていますか? またはTextBlock、他のアイテムを含めることができるいくつかのメソッド/プロパティがありますか?
その他の関連する質問:
1. Click() イベントのようなものを に追加する最良の方法は何Hyperlinkですか?
2. 青いテキストをよりきれいに折り返す方法はありますか? 上記の XAML では、右端の単語を折り返す必要があるとすぐに、代わりに青いテキストのブロック全体が折り返されます。
提供できるイルミネーションに感謝します。