Reputation: 1703
This may sound really NOOBI!
I have a LongListSelector
for showing some items in my app, and I wanted to add this cool effect called TiltEffect
to the items so they show some interaction as user taps on one of the them.
For that matter I searched the internet and came up with this link on MSDN and I have done as instructed there. I downloaded the code sample, added the discussed class to my project and in the MainPage.xaml
I added the following lines:
xmlns:local="clr-namespace:MyNamespace"
local:TiltEffect.IsTiltEnabled="True"
alnd also in the class TiltEffect.cs
I added LongListSelector
as a TiltableItem
like this:
static TiltEffect()
{
// The tiltable items list.
TiltableItems = new List<Type>() { typeof(ButtonBase), typeof(ListBoxItem), typeof(LongListSelector),};
UseLogarithmicEase = false;
}
Now the problem is that when any of the items on the LongListSelector
is tapped, the whole LongListSelector
tilts instead of only the tapped item.
please help!
Upvotes: 1
Views: 929
Reputation: 1703
I found the answer to my problem here
I wrapped my DataTempalte
in a ListBoxItem
, now it looks like this:
<phone:LongListSelector x:Name="MyLongListSelector"
Margin="0,0,0,0"
ItemsSource="{Binding My_Items}"
SelectionChanged="MyLongListSelector_SelectionChanged">
<phone:LongListSelector.ItemTemplate>
<DataTemplate>
<ListBoxItem >
<StackPanel Margin="0,0,0,7" local:TiltEffect.IsTiltEnabled="True" MinWidth="460">
<StackPanel.Background>
<ImageBrush Stretch="Fill" ImageSource="/Assets/Photos/items.png"/>
</StackPanel.Background>
<TextBlock Text="{Binding Title}"
TextWrapping="Wrap" Style="{StaticResource PhoneTextExtraLargeStyle}"
TextAlignment="Center"
Margin="0, 5, 0, 15" FontFamily="Assets/Fonts/BNazanin.ttf#B Nazanin"/>
</StackPanel>
</ListBoxItem>
</DataTemplate>
</phone:LongListSelector.ItemTemplate>
</phone:LongListSelector>
Upvotes: 4
Reputation: 4857
could you try adding type that you used as a jumplist item to The tiltable items Collection instead of LongListSelector.
Upvotes: 0