如何在WP 8.1中打开组合框之前延迟UI反馈

时间:2015-05-18 14:22:14

标签: events windows-phone-8.1

我需要在触摸组合框控件后直接添加延迟(2000ms)。在触摸之后不应该向用户提供任何类型的反馈,而是仅在延迟之后。在WP 8.1中如何做到这一点?

1 个答案:

答案 0 :(得分:0)

与AppBarButton相同的答案,编辑样式并通过RepeatButton替换按钮并延迟。以下是ComboBox样式的摘录:

<ContentPresenter x:Name="HeaderContentPresenter"
    HorizontalAlignment="Left"
    Style="{StaticResource HeaderContentPresenterStyle}"
    FlowDirection="{TemplateBinding FlowDirection}"
    Visibility="Collapsed"
    Content="{TemplateBinding Header}"
    ContentTemplate="{TemplateBinding HeaderTemplate}" 
    Margin="0,0,0,-4.5"/>
    <!-- Presenter for selection/placeholder text when #items is > 5 -->
<RepeatButton x:Name="FlyoutButton" Delay="2000"
    Grid.Row="1"
    FlowDirection="{TemplateBinding FlowDirection}"
    Background="{TemplateBinding Background}"
    BorderBrush="{TemplateBinding BorderBrush}"
    BorderThickness="{TemplateBinding BorderThickness}"
    FontSize="{ThemeResource ContentControlFontSize}"
    FontWeight="Normal"
    HorizontalAlignment="Stretch"
    HorizontalContentAlignment="Left"
    Padding="6.5,0,0,0"
    MinHeight="{ThemeResource ComboBoxItemMinHeightThemeSize}">
    <ContentPresenter x:Name="ContentPresenter" MinHeight="32.5" Margin="0,0.8,0,0">
      <TextBlock x:Name="PlaceholderTextBlock"
        Style="{StaticResource ComboBoxPlaceholderTextBlockStyle}"
        Text="{TemplateBinding PlaceholderText}" margin="0"/>
    </ContentPresenter>
</RepeatButtonButton>