【问题标题】:Windows Phone - ToggleSwitch in LongListSelector (not changing when scrolling)Windows Phone - LongListSelector 中的 ToggleSwitch(滚动时不更改)
【发布时间】:2015-02-18 20:47:29
【问题描述】:

这是我 page.xaml 中的 LongListSelector:

<phone:LongListSelector Name="ModuleList" 
                        Margin="0,0,0,0" 
                        Padding="0,0,0,0"
                        Style="{StaticResource LLSFloatingScrollbarStyle}"
                        ItemTemplate="{StaticResource ModuleListTemplate}"
                        ItemsSource="{Binding Modules}"/>

我的模板:

<DataTemplate x:Key="ModuleListTemplate">
        <StackPanel Margin="{Binding StackModuleMargin}">
...
        <toolkit:ToggleSwitch x:Name="LockSwitch" 
                              Grid.Row="2" Margin="0,4,0,-26" Padding="0"
                              Content="" SwitchForeground="{StaticResource TrackitoOrange}"
                              IsChecked="{Binding IsToggleCheck, Mode=TwoWay}">
                 <i:Interaction.Triggers>
                       <i:EventTrigger EventName="Click">
                             <Command:EventToCommand Command="{Binding DataContext.LockSwitchTapCommand, ElementName=LayoutRoot}"
                                                     CommandParameter="{Binding}" />
                       </i:EventTrigger>
                </i:Interaction.Triggers>
        </toolkit:ToggleSwitch>
...

问题是当我只是滚动列表时会引发点击。是的,我的手指在切换的位置,但我想在滚动时修复它,然后切换不应更改。谢谢

【问题讨论】:

    标签: xaml silverlight windows-phone-8 gesture longlistselector


    【解决方案1】:

    如果您的 UI 中有两个相互竞争的点击事件,您可能应该探索一个设计问题。

    也就是说,您可以覆盖 OnScroll 并将事件标记为在原始级别处理,这样它就不会冒泡到您的切换按钮。

    【讨论】:

    • LongListSelector 没有 OnScroll 事件。
    • 我认为您可以改用 OnManipulationStarted/Completed。
    猜你喜欢
    • 2015-02-26
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-09-24
    • 1970-01-01
    相关资源
    最近更新 更多