如何使用下面绑定的文本来包装图片。 如果我在下面尝试,我会有错误:
错误1“TextBlock”类型的值无法添加到“BlockCollection”类型的集合或词典中
<FlowDocumentScrollViewer>
<FlowDocument IsHyphenationEnabled="True" IsOptimalParagraphEnabled="True" LineHeight="10" LineStackingStrategy="MaxHeight" TextAlignment="Left">
<Paragraph>
<Floater Width="130" HorizontalAlignment="Left" Margin="0,0,5,5" Padding="3">
<TextBlock Margin="5" TextAlignment="center" TextWrapping="Wrap"
Text="{Binding Path=TitleTip}" FontSize="12" Name="style"> </TextBlock>
<BlockUIContainer >
<StackPanel>
<Image Source="{Binding Path=Picture}" Margin="5" Height="30"></Image>
</StackPanel>
</BlockUIContainer>
</Floater>
</Paragraph>
<Paragraph></Paragraph>
</FlowDocument>
</FlowDocumentScrollViewer>
答案 0 :(得分:0)
您需要使用BlockUIContainer包围TextBlock或将其包含在现有的BlockUIContainer中
<BlockUIContainer >
<TextBlock Margin="5" TextAlignment="center" TextWrapping="Wrap"
Text="{Binding Path=TitleTip}" FontSize="12" Name="style"> </TextBlock>
</BlockUIContainer >