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

Programmatically open DatePicker

1 Answer 135 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.
Stephan
Top achievements
Rank 2
Stephan asked on 07 Jul 2013, 12:26 PM
Hi Telerik-Team,

I'm trying to open the DatePicker programmatically but it doesn't work. I already saw the other post where you describe to use the IsPopupOpen property (set it to true). However, this does not seem to work or I miss something. What I currently have is:

/// <summary>
        /// Handles the click on the date selection button
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void ButtonDateSelector_Click(object sender, RoutedEventArgs e)
        {
            var picker = new RadDatePicker();
            LayoutRoot.Children.Add(picker);
            //picker.Value = _currentDate.ToDateTime();
            //picker.ValueChanged += (o, args) => SetPanelFor(new Date((DateTime) args.NewValue));
            picker.IsPopupOpen = true;
        }

What's shown when my button is clicked is the DatePicker control TextBox but the popup does not Show up.

Kind Regards,
Stephan Arenswald

1 Answer, 1 is accepted

Sort by
0
Deyan
Telerik team
answered on 08 Jul 2013, 07:18 AM
Hi Stephan,

Thanks for writing.

Well, the scenario you are implementing is a bit unpopular since you're programmatically inserting the control in the layout and try to open a popup which most probably is not yet retrieved from the control template of RadListPicker.

Can you please try calling the UpdateLayout method of the control instance before setting the IsPopupOpen property? You should also make sure that the control is in a mode which allows opening a popup.

I hope this helps.

Regards,
Deyan
Telerik
TRY TELERIK'S NEWEST PRODUCT - EQATEC APPLICATION ANALYTICS for WINDOWS PHONE 7.
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
Tags
DatePicker and DateSelector
Asked by
Stephan
Top achievements
Rank 2
Answers by
Deyan
Telerik team
Share this question
or