为什么不显示来自 TextBlock 的文本?
Why text from TextBlock is not displaying?
为什么未显示来自以下 TextBlock
的文本。我们怎样才能让它显示在 FlowDocument
上方?
<Window x:Class="WPF_Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPF_Test"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<TextBlock Margin="5" Text="This text is from TextBlock"/>
<FlowDocumentReader>
<FlowDocument Background="GhostWhite" ColumnWidth="10000">
<List MarkerOffset="25" MarkerStyle="Decimal" StartIndex="1">
<ListItem>
<Paragraph Margin="10">Test Paragraph</Paragraph>
<List MarkerStyle="UpperLatin" Margin="0" Padding="0" >
<ListItem Margin="40,5,0,0">
<Paragraph>Test paragraph</Paragraph>
</ListItem>
<ListItem Margin="40,5,0,0">
<Paragraph>Test paragraph</Paragraph>
</ListItem>
<ListItem Margin="40,5,0,0">
<Paragraph>Test paragraph</Paragraph>
</ListItem>
</List>
</ListItem>
<ListItem>
<Paragraph Margin="10">Test paragraph</Paragraph>
</ListItem>
<ListItem>
<Paragraph Margin="10">Test paragraph</Paragraph>
</ListItem>
</List>
</FlowDocument>
</FlowDocumentReader>
</Grid>
</Window>
主窗口显示:
Grid
根据行和列索引添加元素。子元素 TextBox
和 FlowDocumentReader
应位于网格面板的不同 column/row 中:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Margin="5" Text="This text is from TextBlock"/>
<FlowDocumentReader Grid.Row="1">
....
</Grid>
为什么未显示来自以下 TextBlock
的文本。我们怎样才能让它显示在 FlowDocument
上方?
<Window x:Class="WPF_Test.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
xmlns:local="clr-namespace:WPF_Test"
mc:Ignorable="d"
Title="MainWindow" Height="450" Width="800">
<Grid>
<TextBlock Margin="5" Text="This text is from TextBlock"/>
<FlowDocumentReader>
<FlowDocument Background="GhostWhite" ColumnWidth="10000">
<List MarkerOffset="25" MarkerStyle="Decimal" StartIndex="1">
<ListItem>
<Paragraph Margin="10">Test Paragraph</Paragraph>
<List MarkerStyle="UpperLatin" Margin="0" Padding="0" >
<ListItem Margin="40,5,0,0">
<Paragraph>Test paragraph</Paragraph>
</ListItem>
<ListItem Margin="40,5,0,0">
<Paragraph>Test paragraph</Paragraph>
</ListItem>
<ListItem Margin="40,5,0,0">
<Paragraph>Test paragraph</Paragraph>
</ListItem>
</List>
</ListItem>
<ListItem>
<Paragraph Margin="10">Test paragraph</Paragraph>
</ListItem>
<ListItem>
<Paragraph Margin="10">Test paragraph</Paragraph>
</ListItem>
</List>
</FlowDocument>
</FlowDocumentReader>
</Grid>
</Window>
主窗口显示:
Grid
根据行和列索引添加元素。子元素 TextBox
和 FlowDocumentReader
应位于网格面板的不同 column/row 中:
<Grid>
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
<TextBlock Grid.Row="0" Margin="5" Text="This text is from TextBlock"/>
<FlowDocumentReader Grid.Row="1">
....
</Grid>