Search code examples
silverlightwindows-phone-7listboxsilverlight-toolkititemtemplate

Shrinking effect of Tiles on ListBox on Windows Phone


I've created a listbox like this

<ListBox Name="lstNews" SelectionChanged="lstNews_SelectionChanged">
                    <ListBox.ItemsPanel>
                        <ItemsPanelTemplate>
                            <toolkit:WrapPanel />
                        </ItemsPanelTemplate>
                    </ListBox.ItemsPanel>
                    <ListBox.ItemTemplate>
                        <DataTemplate>
                            <Grid Margin="0,0,12,12"  Width="180" Height="180">
                                <Grid.Background>
                                    <ImageBrush>
                                        <ImageBrush.ImageSource>
                                            <BitmapImage CreateOptions="BackgroundCreation" UriSource="{Binding Picture}" />
                                        </ImageBrush.ImageSource>
                                    </ImageBrush>
                                </Grid.Background>
                                <StackPanel Background="#AA000000" VerticalAlignment="Bottom" Height="70" >
                                    <TextBlock Foreground="White" TextWrapping="Wrap" VerticalAlignment="Bottom" FontSize="16" Text="{Binding Title}" />
                                </StackPanel>
                            </Grid>
                        </DataTemplate>
                    </ListBox.ItemTemplate>
</ListBox>

I need to add a shrinking effect when the user taps on an item. I've seen a lot of apps do that, I dunno how.


Solution

  • I assume you are talking about the tilt effect, which can be found in the wp7 toolkit.

    You can set it at the global level by doing this,

        <phone:PhoneApplicationPage xmlns:toolkit="clr-namespace:Microsoft.Phone.Controls;assembly=Microsoft.Phone.Controls.Toolkit" 
               toolkit:TiltEffect.IsTiltEnabled="True">
    

    Some good tutorials.