YosiFZ
YosiFZ

Reputation: 7900

LongListSelector focus on item

I have this LongListSelector in my app page:

<Controls:LongListSelector x:Name="searchList" Margin="0,0,0,0"  Background="White" SelectionChanged="DidPressSelectSearchList" HorizontalContentAlignment="Stretch" Grid.Row="1">
            <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>
                                    <Rectangle Height="1" HorizontalAlignment="Stretch" VerticalAlignment="Top" Fill="Black" Opacity="0.3" />
                                    <Grid>
                                        <Grid.ColumnDefinitions>
                                            <ColumnDefinition Width="100" />
                                            <ColumnDefinition Width="*" />
                                        </Grid.ColumnDefinitions>
                                        <Image Margin="0" Source="{Binding Path=ImgUrl}" HorizontalAlignment="Left" Width="100" Height="100" Tag="{Binding idStr}"/>
                                        <Grid Grid.Column="1" Margin="10,0,8,0">
                                            <Grid.RowDefinitions>
                                                <RowDefinition Height="60"/>
                                                <RowDefinition Height="*"/>
                                                <RowDefinition Height="*"/>
                                            </Grid.RowDefinitions>
                                            <TextBlock Text="{Binding Name}" FontSize="20" Foreground="Black" TextWrapping="Wrap" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" />
                                            <StackPanel Orientation="Horizontal" Margin="0,-5,0,0" Grid.Row="1">
                                                <TextBlock Text="Views:  " FontSize="20" Foreground="Black"/>
                                                <TextBlock Text="{Binding ViewCount}" FontSize="20" Foreground="Black"/>
                                            </StackPanel>

                                            <Grid Grid.Row="2">
                                                <Grid.ColumnDefinitions>
                                                    <ColumnDefinition Width="*"/>
                                                    <ColumnDefinition Width="*"/>
                                                </Grid.ColumnDefinitions>

                                                <TextBlock Text="{Binding TimeStr}" FontSize="20" Foreground="Black" Margin="0,0,0,0" />
                                                <TextBlock Text="Cached" FontSize="20" Foreground="Red" Margin="20,0,0,0" Grid.Column="1" />
                                            </Grid>
                                        </Grid>
                                    </Grid>

                                </Grid>

                            </DataTemplate>
                        </local:SearchTemplateSelector.VideoTemplate>

                    </local:SearchTemplateSelector>
                </DataTemplate>


            </Controls:LongListSelector.ItemTemplate>
        </Controls:LongListSelector>

And i noticed that when i press a item in the list so the user not have any thing to know which item he pressed, something like focus the item when he press it. In iPhone the the selected row get blue and when release the blue selection is disappear,there is some equivalent to this in windows phone too?

Upvotes: 1

Views: 419

Answers (1)

Pavel Saniuk
Pavel Saniuk

Reputation: 788

Use TiltEffect from Silverlight Toolkit for Windows Phone, details are here http://www.geekchamp.com/articles/silverlight-for-wp7-toolkit-tilteffect-in-depth. Also to make an effect more expressive use Button as a container for your ItemTemplate with EmptyButtonStyle http://www.jeff.wilcox.name/2011/10/hyperlinkbutton-empty-style-for-phone/.

Upvotes: 2

Related Questions