Intercept and Cancel Tap Event

4 posts, 0 answers
  1. Anthony
    Anthony avatar
    17 posts
    Member since:
    May 2011

    Posted 02 Jan 2012 Link to this post

    Hi,

    Is there a way to intercept and cancel the popup window given a condition.

    I attempted to use the Tap event and set the GestureEventArgs.Handled to true, however, the Date Picker window still appears.

    Thanks,
    Ant
  2. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 04 Jan 2012 Link to this post

    Hello Anthony Ramirez,

    Currently the only way to implement this scenario is to inherit from RadDatePicker, find the PickerBox template part which is used to display the popup and use its PopupOpening event to prevent the popup from opening.

    Here is a sample code snippet how you can do this:
    public class MyDatePicker : RadDatePicker
    {
        private RadPickerBox pickerBox;
     
        public override void OnApplyTemplate()
        {
            base.OnApplyTemplate();
     
            this.pickerBox = this.GetTemplateChild("PART_PickerBox") as RadPickerBox;
     
            this.pickerBox.PopupOpening += this.OnPickerBox_PopupOpening;
        }
     
        private void OnPickerBox_PopupOpening(object sender, System.ComponentModel.CancelEventArgs e)
        {
             
        }
    }

    After that, you can use the inherited control in XAML by adding the correct namespace and instantiating it as follows:

    <Grid x:Name="LayoutRoot" Background="Transparent">
        <local:MyDatePicker x:Name="myDatePicker"/>
    </Grid>

    I hope this helps.

    All the best,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

  3. DevCraft banner
  4. Anthony
    Anthony avatar
    17 posts
    Member since:
    May 2011

    Posted 04 Jan 2012 Link to this post

    Thanks,
    I'll have to give that a try.

    As always,
    Thanks so much for the super fast replies.  Its appreciated ;)

    Take care,
    Ant
  5. Deyan
    Admin
    Deyan avatar
    2041 posts

    Posted 05 Jan 2012 Link to this post

    Hi Anthony,

    Thanks for the nice words.

    We will do our best to improve the API of RadDate-/RadTimePicker to support your scenario as well.

    Do not hesitate to get back to us in case you have further questions or need assistance.

    Regards,
    Deyan
    the Telerik team

    Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get it now >>

Back to Top