Question

I have a listbox with for data templates, and I want to disable the tilt effect on one of the data templates, but it is not working... this is what I've been trying:

                <ListBox ScrollViewer.VerticalScrollBarVisibility="Disabled" x:Name="MainListBox" Margin="0,10,0,0" SelectionChanged="MainListBoxSelectionChanged">
                        <ListBox.ItemTemplate>
                            <DataTemplate>
                            <local:Datatemplates Content="{Binding}">
                                <local:Datatemplates.ThirdItem>
                                    <DataTemplate>
                                        <Grid x:Name="ContentPanel" Grid.Row="1" Margin="0,10" >
                                            <Grid.ColumnDefinitions>
                                                <ColumnDefinition Width="Auto"/>
                                                <ColumnDefinition Width="*"/>
                                            </Grid.ColumnDefinitions>
                                            <StackPanel Grid.Column="1" toolkit:TiltEffect.SuppressTilt="True">
                                                <TextBlock Text="{Binding Title}" TextWrapping="NoWrap" FontSize="{StaticResource PhoneFontSizeExtraLarge}" Style="{StaticResource PhoneTextGroupHeaderStyle}" toolkit:TiltEffect.SuppressTilt="True"/>
                                                <TextBlock Text="{Binding SubTitle1}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSmallStyle}" toolkit:TiltEffect.SuppressTilt="True"/>
                                                <TextBlock Text="{Binding SubTitle2}" TextWrapping="Wrap" Margin="12,-6,12,0" Style="{StaticResource PhoneTextSmallStyle}" toolkit:TiltEffect.SuppressTilt="True"/>
                                            </StackPanel>
                                        </Grid>
                                    </DataTemplate>
                                </local:Datatemplates.ThirdItem>
                            </local:ProfileSetupDatatemplates>
                          </DataTemplate>
                        </ListBox.ItemTemplate>
                    </ListBox>

I already tried to put the suppress tilt effect everywhere it wasn't working.

What am I missing

Was it helpful?

Solution

TiltEffect is only applied to button controls (Button, CheckBox, etc.) and ListBoxItems, so trying to suppress it on a Stackpanel won't work.

So:

you should be able to tweak your template like so:

<DataTemplate>
    <ListBoxItem toolkit:TiltEffect.SuppressTilt="True"  >
    ...your code
    </ListBoxItem>
</DataTemplate>
Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top