This is a migrated thread and some comments may be shown as answers.

Intercept and Cancel Tap Event

3 Answers 69 Views
DatePicker and DateSelector
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
Anthony
Top achievements
Rank 1
Anthony asked on 03 Jan 2012, 02:20 AM
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

3 Answers, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 04 Jan 2012, 09:54 AM
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 >>

0
Anthony
Top achievements
Rank 1
answered on 04 Jan 2012, 06:47 PM
Thanks,
I'll have to give that a try.

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

Take care,
Ant
0
Deyan
Telerik team
answered on 05 Jan 2012, 10:05 AM
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 >>

Tags
DatePicker and DateSelector
Asked by
Anthony
Top achievements
Rank 1
Answers by
Deyan
Telerik team
Anthony
Top achievements
Rank 1
Share this question
or