3

我有这个 LongListSelector:

<Controls:LongListSelector x:Name="searchList" Margin="0,0,0,0"  Background="White" SelectionChanged="DidPressSelectSearchList" HorizontalContentAlignment="Stretch" Grid.Row="1" KeyDown="UserPressEnterKeyBoard">
                <Controls:LongListSelector.ItemTemplate>
                    <DataTemplate>
                        <local:SearchTemplateSelector Content="{Binding}" HorizontalContentAlignment="Stretch">
                            <local:SearchTemplateSelector.GoogleSuggestTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Rectangle Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Fill="Black" Opacity="0.3"/>
                                        <TextBlock Text="{Binding}" FontSize="25" Foreground="Black" TextWrapping="Wrap" Grid.Row="1" Margin="0,10"/>
                                    </Grid>
                                </DataTemplate>
                            </local:SearchTemplateSelector.GoogleSuggestTemplate>

                            <local:SearchTemplateSelector.VideoTemplate>
                                <DataTemplate>
                                    <Grid>
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*" />
                                            <RowDefinition Height="Auto" />
                                        </Grid.RowDefinitions>
                                        <Rectangle Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Fill="Black" Opacity="0.3"/>
                                        <TextBlock Text="{Binding}" FontSize="25" Foreground="Black" TextWrapping="Wrap" Grid.Row="1" Margin="0,10"/>
                                    </Grid>
                                </DataTemplate>
                                </local:SearchTemplateSelector.VideoTemplate>
                    </local:SearchTemplateSelector>
                    </DataTemplate>
</Controls:LongListSelector.ItemTemplate>

因此,当我选择 GoogleSuggestTemplate 时,我得到了这个(如您所见,分隔符一直到行尾):在此处输入图像描述

当我使用 VideoTemplate 时(如您所见,分隔符在结束前被剪切): 在此处输入图像描述

知道为什么会这样吗?

4

0 回答 0