Вопрос

I'm displaying a simple twitter feed in my app and I have implemented a refresh method in the context menu. Problem is that displaying the context menu performs poorly (it's not a matter of quantity of items, happens with just a few). It seems I need to tap/hold extra long and then the context menu appears - not with the smooth animation, but a bit with a jolt. Ideally it would be nice to have it perform more like the people hub where there is instant feedback that you've tapped the item, and then the context menu appears in with the smooth animation.

Another part of this that baffles me is when the context menu does appear, the rest of the screen sort of "shrinks to the background" to draw attention to the selected item. It seems this would have something to do with the perf problem. Again, look to the people hub for ideal behavior on this matter.

Any tips on how to implement this better?

here's my xaml:

        <!-- twitter feed-->
        <controls:PivotItem Header="feed">
            <ScrollViewer>

                <StackPanel>
                    <ItemsControl ItemsSource="{Binding Tweets}">
                        <ItemsControl.ItemTemplate>
                            <DataTemplate>
                                <Border Padding="12">

                                    <toolkit:ContextMenuService.ContextMenu>
                                        <toolkit:ContextMenu >
                                            <toolkit:MenuItem Header="refresh" Command="{Binding Main.RefreshTweetsCommand, Source={StaticResource Locator}}" />
                                        </toolkit:ContextMenu>
                                    </toolkit:ContextMenuService.ContextMenu>

                                    <StackPanel Orientation="Horizontal">
                                        <Image Source="{Binding user.profile_image_url}" Margin="0,12,0,0" Height="80" Width="80" Stretch="UniformToFill" VerticalAlignment="Top"/>
                                        <Border Padding="12,0,0,0">
                                            <StackPanel>
                                                <TextBlock Text="{Binding user.name}" Foreground="Blue" FontSize="30" />
                                                <TextBlock Text="{Binding date_created}" FontSize="16"/>
                                                <TextBlock Text="{Binding text}" FontSize="20" TextWrapping="Wrap" Width="320" />
                                            </StackPanel>
                                        </Border>
                                    </StackPanel>                                       

                               </Border>
                            </DataTemplate>
                        </ItemsControl.ItemTemplate>
                    </ItemsControl>
                    <TextBlock Text="more . . ." FontSize="32" Padding="20">
                        <i:Interaction.Triggers>
                            <i:EventTrigger EventName="Tap">
                                <cmd:EventToCommand Command="{Binding MoreTweetsCommand, Mode=OneWay}"/>
                            </i:EventTrigger>
                        </i:Interaction.Triggers>
                    </TextBlock>
                </StackPanel>
            </ScrollViewer>
        </controls:PivotItem>
Это было полезно?

Решение

The "shrinks to the background" problem is done in the people hub too, it's just not as obvious. You can change this with the IsZoomEnabled property, see http://www.windowsphonegeek.com/articles/WP7-ContextMenu-in-depth--Part1-key-concepts-and-API.

I've noticed that the animation is quite jerky as well, in comparison to Microsoft's implementation.

Лицензировано под: CC-BY-SA с атрибуция
Не связан с StackOverflow
scroll top