ContentControl与ContentPresenter区别?

时间:2022-10-02 00:11:21

<TextBlock HorizontalAlignment="Left" Text="{Binding HwContent, Converter={StaticResource TextSerialize}}" VerticalAlignment="Top" Margin="76,26,160,0" TextTrimming="CharacterEllipsis" Grid.Column="0" Height="Auto" FontSize="14" LineHeight="24" Cursor="Hand" TextWrapping="NoWrap" Foreground="{DynamicResource Foreground_Gray_level2}">
                        <TextBlock.ToolTip >
                            <ContentControl   Content="{Binding HwContent}" >
                                <ContentControl.ContentTemplate>
                                    <DataTemplate>
                                        <Border MaxWidth="600" MinHeight="16" MaxHeight="320" Padding="5,5,5,5">
                                            <TextBlock TextWrapping="Wrap" TextTrimming="CharacterEllipsis" Text="{Binding Mode=OneTime}"/>
                                        </Border>
                                    </DataTemplate>
                                </ContentControl.ContentTemplate>
                            </ContentControl>
                        </TextBlock.ToolTip>
                    </TextBlock>

ContentPresenter显示不出来,但是ContentControl  能显示出来