■ Style 엘리먼트 : TargetType 속성을 사용해 Paragraph 스타일 설정하기

----------------------------------------------------------------------------------------------------

<Page

    xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"

    xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"

    Title="I. Down the Rabbit-Hole">

    <Page.Resources>

        <Style x:Key="ParagraphKey" TargetType="{x:Type Paragraph}">

            <Setter Property="TextIndent" Value="0.25in" />

        </Style>

        <Style x:Key="HeaderParagraphKey" TargetType="{x:Type Paragraph}">

            <Setter Property="TextAlignment" Value="Center" />

            <Setter Property="FontSize"      Value="16pt"   />

        </Style>

    </Page.Resources>

    <FlowDocumentReader>

        <FlowDocument>

            <Paragraph Style="{StaticResource HeaderParagraphKey}">Chapter I</Paragraph>

            <Paragraph Style="{StaticResource HeaderParagraphKey}">Down the Rabbit-Hole</Paragraph>

            <Paragraph Style="{StaticResource ParagraphKey}">

                Alice was beginning to get very tired of sitting by

                her sister on the bank, and of having nothing to do:

                once or twice she had peeped into the book her sister

                was reading, but it had no pictures or conversations

                in it, “and what is the use of a book,”

                thought Alice, “without pictures or

                conversations?”

            </Paragraph>

            <Paragraph Style="{StaticResource ParagraphKey}">

                ...

            </Paragraph>

        </FlowDocument>

    </FlowDocumentReader>

</Page>

----------------------------------------------------------------------------------------------------

Posted by 사용자 icodebroker
TAG