对带有项目符号和不同字体的标题和正文使用一个文本块



我有一个ScrollViewer,里面有一个TextBlock,我想动态填充它。我想就这样做的最佳方法提供一些建议。这是我的 XAML,TextBlock中有一个示例"条目"。

<ScrollViewer Background="White">
    <ScrollViewer.Resources>
        <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">30</sys:Double>
    </ScrollViewer.Resources>
    <TextBlock FontSize="26"
                   HorizontalAlignment="Left"
                   Margin="25">
            <Run Text="April 14, 2017"
                        FontFamily="VAG Rounded"
                        FontWeight="Bold" /><LineBreak />
            <Run Text="• Updates galore!" /><LineBreak />
            <Run Text="-------------------------------------------------------------------------------------------------------------------" />
    </TextBlock>
</ScrollViewer>

我只想在 VAG 圆形粗体标题和默认字体正文之间留出一点空间。它看起来不像运行允许边距或填充。我应该只插入一个字体非常小的空行吗?

我也非常感谢对其余部分的任何反馈。

如果您使用Panel(如Grid(作为ScrollViewerContent,则可以使用多个具有单个边距的TextBlocks,例如:

<ScrollViewer Background="White">
        <ScrollViewer.Resources>
            <sys:Double x:Key="{x:Static SystemParameters.VerticalScrollBarWidthKey}">30</sys:Double>
        </ScrollViewer.Resources>-->
    <Grid>
        <Grid.RowDefinitions>
            <RowDefinition Height="Auto" />
            <RowDefinition Height="*" />
        </Grid.RowDefinitions>
        <TextBlock FontSize="26" FontFamily="VAG Rounded" FontWeight="Bold" Text="April 14, 2017" />
        <TextBlock FontSize="26" Margin="25" Grid.Row="1">
            <Run Text="• Updates galore!" />
            <LineBreak />
            <Run Text="-------------------------------------------------------------------------------------------------------------------" />
        </TextBlock>
    </Grid>
</ScrollViewer>

最新更新