Programmatically open DatePicker

2 posts, 0 answers
  1. Stephan
    Stephan avatar
    29 posts
    Member since:
    May 2013

    Posted 07 Jul 2013 Link to this post

    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
  2. Deyan
    Admin
    Deyan avatar
    2039 posts

    Posted 08 Jul 2013 Link to this post

    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 >>
  3. DevCraft banner
Back to Top