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

Open RadDatePicker programmatically

7 Answers 182 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.
Alex
Top achievements
Rank 1
Alex asked on 07 Aug 2012, 03:54 AM
Hello.

Is there a way to open RadDatePicker from the code? I want use it in such way:

var datePicker = new RadDatePicker();
this.LayoutRoot.Children.Add(datePicker);
...
datePicker.Open();

I've found an implementation for DatePicker from Silverlight Toolkit:
http://transoceanic.blogspot.com/2011/08/wp7-create-datepicker-control.html
But I can't adapt this example for RadDatePicker.

Thanks in advance.

P.S. I've made a mistake in the title of the post - "programmatically". Please fix it.

7 Answers, 1 is accepted

Sort by
0
Accepted
Todor
Telerik team
answered on 07 Aug 2012, 06:21 AM
Hi Alex,

Yes, you can open RadDatePicker programmatically. You can do it by setting the IsPopupOpen property to true. This will cause the popup to expand and the user will be able to select a new date.

All the best,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alex
Top achievements
Rank 1
answered on 07 Aug 2012, 04:23 PM
Ok. Thanks. If I try to use this functionality from code then it works fine.

And I've tried to implement this by using of binding. But with no success. Popup doesn't open.
Can I change IsPopupOpen property through binding? 
0
Todor
Telerik team
answered on 08 Aug 2012, 08:22 AM
Hi Alex,

We are changing the value of the IsPopupOpen property programmatically and the new value that we set replaces your binding. The solution is to create two-way binding to the IsPopupOpen property. For example if you have ToggleButton, instead of binding IsPopupOpen to ToggleButton's IsChecked property, you should do the opposite:
<telerikInput:RadDatePicker x:Name="datePicker" />
<ToggleButton Content="open popup" IsChecked="{Binding ElementName=datePicker, Path=IsPopupOpen, Mode=TwoWay}"/>


Kind regards,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Alex
Top achievements
Rank 1
answered on 08 Aug 2012, 09:02 AM
In my previous post I meant that I want to use RadDatePicker in a such way:


<
telerik:RadDatePicker 
IsPopupOpen="{Binding IsPopupOpen, Mode=TwoWay"/>

public class DataViewModel: INotifyPropertyChanged
{
//...
  private bool _isPopupOpen; 
 
  public bool IsPopupOpen
  {
    get
    {
      return _isPopupOpen;
    }
 
    set
    {
      _isPopupOpen = value;
      OnNotifyChanged("IsPopupOpen");
    }
  }
//...
  private Method()
  {
    IsPopupOpen = true;
  }
//...
}

I want to invoke Method() to open DatePicker.
Will this code work or not?
0
Accepted
Todor
Telerik team
answered on 09 Aug 2012, 08:31 AM
Hi Alex,

This code will not have the desired effect, because in the current version of RadDatePicker we are changing the value of the IsPopupOpen property internally and this breaks the binding. We are going to change that so that you will be able to open the popup with the code that you are using. The changes will be included in our next internal build, which will be released next week. Stay tuned and get it from the Downloads section of your account, once it's available.

Greetings,
Todor
the Telerik team

Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.

0
Petr
Top achievements
Rank 1
answered on 03 Feb 2015, 12:24 PM
Hello,

I tried same thing today and i think that the binding still not work.

0
Rosy Topchiyska
Telerik team
answered on 06 Feb 2015, 12:15 PM
Hello Tomas,

Thank you for contacting us. It seems that the fix for this issue didn't make it to the official version for some reason. We will include it in the next release. Thank you very much for pointing out this issue. I have updated your Telerik points as a token of gratitude.  

Regards,
Rosy Topchiyska
Telerik
 

Check out the Telerik Platform - the only platform that combines a rich set of UI tools with powerful cloud services to develop web, hybrid and native mobile apps.

 
Tags
DatePicker and DateSelector
Asked by
Alex
Top achievements
Rank 1
Answers by
Todor
Telerik team
Alex
Top achievements
Rank 1
Petr
Top achievements
Rank 1
Rosy Topchiyska
Telerik team
Share this question
or