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

How to acces a DatePicker in a Grid

5 Answers 73 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
Juan Camilo zapata
Top achievements
Rank 1
Juan Camilo zapata asked on 23 Jan 2010, 11:30 PM
Hi, i have the following code, and what I want is that RadDatePicker "picker" is accessible from the code. Try typing in code, picker and does not recognize it, if can help me to give some properties to the DatePicker. I have a grid, and there declare an datepicker for a date, I do so because I have a template for the datepicker.
Thank you very Much

<telerikGridView:GridViewDataColumn Header="Date"  > 
                    <telerikGridView:GridViewDataColumn.CellTemplate> 
                        <DataTemplate> 
                            <TextBlock Text="{Binding Date}" /> 
                        </DataTemplate> 
                    </telerikGridView:GridViewDataColumn.CellTemplate> 
                    <telerikGridView:GridViewDataColumn.CellEditTemplate> 
                        <DataTemplate> 
                            <telerik:RadDatePicker x:Name="picker" DayTemplate="{x:Null}" /> 
                        </DataTemplate> 
                    </telerikGridView:GridViewDataColumn.CellEditTemplate> 
</telerikGridView:GridViewDataColumn> 

5 Answers, 1 is accepted

Sort by
0
Juan Camilo zapata
Top achievements
Rank 1
answered on 27 Jan 2010, 08:15 PM
there is someone who can help me?
0
Kaloyan
Telerik team
answered on 28 Jan 2010, 08:23 AM
Hi Juan Camilo zapata,

The CellEditTemplate property is of DataTemplate type. This means that every control placed in DataTemplate appears in different visual tree then the main one. That's why there is now way to access any controls placed in it(DataTemplate).

Regards,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Juan Camilo zapata
Top achievements
Rank 1
answered on 28 Jan 2010, 02:53 PM
Hi Kaloyan, the truth did not quite understand your reply. You said "That's why there is now way to access any controls placed in it", or what you meant was "That's why there is no way to access any controls placed in it". If is can be done, can guide me how to do it.
Thanks
0
Accepted
Kaloyan
Telerik team
answered on 01 Feb 2010, 12:57 PM
Hello Juan Camilo zapata,

What i mean is  that the Silverlight runtime will not recognize the element with x:Name placed inside the DataTemplate. This is due to the framework restriction. Nonetheless you can obtain a reference to the element using the VisualTreeHelper. Find the posted link with a demonstration of this approach.

Sincerely yours,
Kaloyan
the Telerik team

Instantly find answers to your questions on the new Telerik Support Portal.
Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
0
Juan Camilo zapata
Top achievements
Rank 1
answered on 01 Feb 2010, 01:03 PM
Kaloyan, thank you very much, helped me a lot your information.
Greetings
Tags
DatePicker
Asked by
Juan Camilo zapata
Top achievements
Rank 1
Answers by
Juan Camilo zapata
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or