1

如何用如下绑定的文本包装图片。如果我在下面尝试,我会遇到错误:

错误 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>
4

1 回答 1

0

您需要用 BlockUIContainer 包围 TextBlock 或将其包含在现有的 BlockUIContainer 中

<BlockUIContainer > 
<TextBlock Margin="5" TextAlignment="center" TextWrapping="Wrap" 
 Text="{Binding Path=TitleTip}" FontSize="12" Name="style"> </TextBlock>
 </BlockUIContainer >
于 2016-07-25T08:52:13.137 回答