简体   繁体   English

Windows Phone侧面菜单的listboxitem

[英]Windows phone side menu for a listboxitem

I want to create a side menu for a specific listboxitem or longlistselector's item like the picture 我想为特定的listboxitem或longlistselector的项目(如图片)创建侧面菜单 在此处输入图片说明

when your press and hold the listboxitem the blue panel comes out, is there anyway to this ? 当您按住listboxitem时,蓝色面板会出现,这是否有帮助?

I managed the Hold event on the item, but not the side menu ! 我管理了该项目的Hold事件,但没有管理侧面菜单!

You can include this menu in your Item Template and set its Visibility to Collapsed . 您可以将此菜单包含在Item Template ,并将其Visibility设置为Collapsed And then add code to your Hold event that will show it. 然后将代码添加到您的Hold事件中以显示它。 Take a look at Storyboard class for possible animations. 看一下Storyboard类中可能的动画。

There are a few possible ways to do this, but the basic idea is that you add the menu in a hidden or collapsed state, and then trigger an animation on the Hold event. 有几种方法可以执行此操作,但是基本思想是您将菜单添加为隐藏或折叠状态,然后在Hold事件上触发动画。 Here is a simple example (using the interactivity DLLs System.Windows.Interactivity and Microsoft.Expression.Interactions.Core): 这是一个简单的示例(使用交互DLL System.Windows.Interactivity和Microsoft.Expression.Interactions.Core):

<Grid xmlns:i="http://schemas.microsoft.com/expression/2010/interactivity"
      xmlns:ei="http://schemas.microsoft.com/expression/2010/interactions">
    <Grid.Resources>
        <Storyboard x:Name="ShowMenu">
            <DoubleAnimation Storyboard.TargetName="translate" Storyboard.TargetProperty="X" 
                             To="0" Duration="0:0:0.3" />
        </Storyboard>
        <Storyboard x:Name="HideMenu">
            <DoubleAnimation Storyboard.TargetName="translate" Storyboard.TargetProperty="X" 
                             To="-300" Duration="0:0:0.3" />
        </Storyboard>
    </Grid.Resources>

    <Grid Width="300" Background="LightBlue">
        <Grid.RenderTransform>
            <TranslateTransform x:Name="translate" X="-300" />
        </Grid.RenderTransform>

        <!-- Menu popup content here -->
        <TextBlock Text="Menu">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Hold">
                    <ei:ControlStoryboardAction Storyboard="{StaticResource HideMenu}" ControlStoryboardOption="Play" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </TextBlock>
    </Grid>

    <Grid>
        <!-- Item content here -->
        <TextBlock Text="Item">
            <i:Interaction.Triggers>
                <i:EventTrigger EventName="Hold">
                    <ei:ControlStoryboardAction Storyboard="{StaticResource ShowMenu}" ControlStoryboardOption="Play" />
                </i:EventTrigger>
            </i:Interaction.Triggers>
        </TextBlock
    </Grid>
</Grid>

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 将Windows Phone上下文菜单的Silverlight工具箱添加到C#中的listboxitem - Adding a silverlight toolkit for windows phone context menu to a listboxitem in C# 侧面菜单xaml导航错误Windows Phone 8 - Side Menu xaml Navigation Error windows phone 8 Windows Phone 7.1具有文本和值的listBoxItem - windows phone 7.1 listBoxItem having Text and value 更改列表框中所有ListBoxItem的样式(Windows Phone 8) - Change style for all ListBoxItem in a ListBox (Windows phone 8) Windows手机像Facebook一样创建侧面菜单栏 - Windows phone create side menu bar like Facebook 从Windows Phone中的代码处理ListBoxItem模板的点击事件 - Handle tap event for ListBoxItem template from code in Windows phone 如何在Silverlight / Windows phone 7中一般重复listboxitem的样式 - How to generically repeat the style of a listboxitem in Silverlight / Windows phone 7 如何访问Windows Phone 7中ListBoxItem内的单选按钮 - how do I access a radiobutton inside a ListBoxItem in windows phone 7 在项目选择上,更改Windows Phone中ListBoxItem组成的矩形的颜色 - On item selection, changing the color of a rectangle which is part of a ListBoxItem in Windows Phone Windows 电话 7,获取列表框项名称并将其传递给另一个 xaml 页面 - Windows phone 7, grabbing listboxitem name and passing it to another xaml page
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM