Architect's Log

I'm a Cloud Architect. I'm highly motivated to reduce toils with driving DevOps.

Run要素を使用してリッチテキストを表示する

アプリ実行


ソースコード

App.xaml
<Application x:Class="HelloWorld.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
</Application>
MainWindow.xaml
<Window x:Class="HellloWorld.MainWindow"
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        Title="MainWindow" Height="100" Width="200">
    <TextBlock>
        こんにちは, 
        <Run FontWeight="Bold">太い線</Run>, 
        <Run FontStyle="Italic">イタリック</Run>, 
        <Run TextDecorations="Underline">下線</Run>
    </TextBlock>
</Window>

参考

Run クラス (System.Windows.Documents)
フォーマット済みテキストまたは未フォーマット テキストのランを格納するためのインラインレベル フロー コンテンツ要素。