1

そのため、テキストボックスが内部にある longlistselector があります。ユーザーはこれらのテキストボックスを操作して、さらにテキストを挿入できます。テキストが挿入されると、テキストボックスが展開され、ユーザーは書き続けて概要を把握できます。

しかし、ユーザーが longlistselector の一番下に到達し、最後のテキスト ボックスに書き込みを開始すると、テキスト ボックスは longlistselector の外に拡張されます。つまり、ユーザーは書き込みを停止し、ロングリストセレクターを下にスクロールしてから、書き込みを続行する必要があります。

したがって、問題は、テキストボックスがロングリストセレクターの下部にあり、テキストが拡大して表示されなくなると、ロングリストセレクターがスクロールダウンしないことです。

これは longlistselector の私の xaml コードです

<Grid x:Name="ContentPanel" Margin="12,49,12,0" Grid.RowSpan="2">

        <Grid.RowDefinitions>
            <RowDefinition Height="*"/>
        </Grid.RowDefinitions>
        <phone:LongListSelector x:Name="ChatList"  Grid.Row="0" HorizontalAlignment="Left" Width="456" Padding="0" >
            <phone:LongListSelector.ItemTemplate>
                <DataTemplate>
                    <local:ChatRoomTemplateSelector Content="{Binding}">
                        <local:ChatRoomTemplateSelector.YourSelf>
                            <DataTemplate x:Name="YourSelf">
                                <StackPanel>
                                    <Grid x:Name="YourSelfGrid">
                                        <Grid.RowDefinitions>
                                            <RowDefinition Height="*"/>
                                        </Grid.RowDefinitions>
                                        <UserControl Grid.Row="0">
                                            <Path Data="Data" Fill="LawnGreen" StrokeThickness="0" Stretch="Fill" UseLayoutRounding="True"/>
                                        </UserControl>
                                        <TextBox Background="LawnGreen" Text="{Binding Path=Post, Mode=TwoWay,UpdateSourceTrigger=Explicit}" IsReadOnly="{Binding readOnly}" FontSize="20" Margin="39,10" TextWrapping="Wrap" BorderBrush="LawnGreen" Style="{StaticResource TextBoxStyleYourself}" TextChanged="OnTextBoxTextChanged"/>

                                    </Grid>
                                    <StackPanel Orientation="Horizontal">

                                        <Path Data="Data" Fill="LawnGreen" StrokeThickness="0" Stretch="Fill" UseLayoutRounding="True" Margin="50,-1,0,0"/>

                                        <TextBlock Text="{Binding Name}" FontWeight="Bold" FontSize="25" TextWrapping="Wrap"/>
                                    </StackPanel>
                                </StackPanel>
                            </DataTemplate>
                        </local:ChatRoomTemplateSelector.YourSelf>
                        </local:ChatRoomTemplateSelector>
                </DataTemplate>
            </phone:LongListSelector.ItemTemplate>
        </phone:LongListSelector>

    </Grid>
</Grid>

そして、このコード スニペットを使用して longlistselector にコンテンツを追加します

source.Add(new Data() { Name = ChatRoomOverview.userName, User = "YourSelf", readOnly = false, Post = "" });
ChatList.ItemsSource = source;

編集

起動時に最後の要素までスクロールする方法を知っており、LLS は正常に動作します。しかし、最後に挿入された要素のユーザーが多くのテキストを入力すると、テキストボックスがビューの外側に拡張され、LLS がアイテムを表示し続けることができなくなります。どうすればいいですか?

4

1 に答える 1