Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/google-apps-script/5.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
C# 如何在XAML中设置文本块的动画以完全显示它_C#_Xaml_Windows Phone 8 - Fatal编程技术网

C# 如何在XAML中设置文本块的动画以完全显示它

C# 如何在XAML中设置文本块的动画以完全显示它,c#,xaml,windows-phone-8,C#,Xaml,Windows Phone 8,我有一个很长的列表选择器,它显示一个图像,两个文本块(名称和说明以及其他图像以共享项目。问题是,说明和图像通常大于网格的大小,因此我只能显示开头。我想要的是使用动画将文本块的文本自动滚动到左侧,以完全显示它。是吗这可能吗? 我的xaml项目的代码如下 <phone:LongListSelector x:Name="GaleryLongListSelector" SelectionChanged="GaleryLongListSelector_SelectionChanged">

我有一个很长的列表选择器,它显示一个
图像
,两个
文本块
(名称和说明以及其他
图像
以共享项目。问题是,说明和图像通常大于网格的大小,因此我只能显示开头。我想要的是使用动画将
文本块
的文本自动滚动到左侧,以完全显示它。是吗这可能吗? 我的xaml项目的代码如下

<phone:LongListSelector x:Name="GaleryLongListSelector" SelectionChanged="GaleryLongListSelector_SelectionChanged">
                <phone:LongListSelector.ItemTemplate>
                    <DataTemplate>
                        <Grid>
                            <Grid.ColumnDefinitions>
                                <ColumnDefinition Width="*"/>
                                <ColumnDefinition Width="Auto"/>
                            </Grid.ColumnDefinitions>
                            <StackPanel Orientation="Horizontal" Margin="12,2,0,4" Height="100"  toolkit:TiltEffect.IsTiltEnabled="True" Grid.Column="0">
                                <Image Width="80" RenderTransformOrigin="0.5,0.5" Height="80" Source="{Binding ThumbImage}" Margin="5,0">
                                    <Image.RenderTransform>
                                        <RotateTransform Angle="90"/>
                                    </Image.RenderTransform>
                                </Image>
                                <StackPanel Orientation="Vertical">
                                <TextBlock x:Name="txtProjectName" Text="{Binding Name}" Margin="5,10,0,0"   Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeLarge}" />
                                <TextBlock x:Name="txtProjectDescript" Text="Aqui iria una descripcion muy larga del faldksjfjkldjfkldajsfkljaslfkjasldfjlasdjfkl"    Style="{StaticResource PhoneTextExtraLargeStyle}" FontSize="{StaticResource PhoneFontSizeLarge}" />
                                </StackPanel>
                            </StackPanel>
                            <Image Source="/Images/share.png" Width="80" Tap="Image_Tap" Grid.Column="1" HorizontalAlignment="Right"/>
                            <toolkit:ContextMenuService.ContextMenu>
                                <toolkit:ContextMenu IsZoomEnabled="True" x:Name="ContextMenu" >
                                    <toolkit:MenuItem  Header="{Binding Source={StaticResource LocalizedStrings}, Path=LocalizedResources.MainPagePanoramaItemGalleryContextMenuDelete}" Click="Delete_Click"/>
                                    <toolkit:MenuItem  Header="{Binding Source={StaticResource LocalizedStrings}, Path=LocalizedResources.MainPagePanoramaItemGalleryContextMenuRename}" Click="Rename_Click"/>
                                </toolkit:ContextMenu>
                            </toolkit:ContextMenuService.ContextMenu>
                        </Grid>
                    </DataTemplate>
                </phone:LongListSelector.ItemTemplate>
            </phone:LongListSelector>

感谢您的帮助。

编辑

只需在ScrollViewer中包装描述文本块,并将HorizontalScrollBarVisibility设置为auto

<ScrollViewer HorizontalScrollBarVisibility="Auto">
    <TextBlock x:Name="txtProjectDescipt" .../>
</ScrollViewer>

我在评论中的意思是,您是否尝试过使用以下方法:

            <ScrollViewer>
                <TextBlock Text="Mon texte de test" />
            </ScrollViewer>

如果文本太长,则应使其可滚动。
然后你只需要创建动画,自动滚动它

用ScrollViewer包装它怎么样?我不明白你的意思@Miiite。我也试着设置TextWrapping=“Wrap”属性,但没有任何结果。我也尝试过,但没有任何结果。如果我使用滚动查看器,我可以手动滚动,但我想自动滚动。使用此代码的另一个问题是,当我删除文本时,它会返回默认位置。请看这里: