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

Problem with RadDatePicker LostFocus Event.

3 Answers 338 Views
DatePicker
This is a migrated thread and some comments may be shown as answers.
SivaPrasad Bevara
Top achievements
Rank 1
SivaPrasad Bevara asked on 30 Nov 2010, 03:04 PM
Hi,

I have a RadDatePicker control in my application.

I need to disable the RadDatePicker control whenever it lost the focus (when we do tab out from the control). I have written the code to disable the control in the LostFocus event.

But it is Disabling the control even I click on the Calender button also.

I mean it is firing the lost focus event first when I click on the Calender button.

Following is the sample code which I am using.

<StackPanel x:Name="LayoutRoot" Background="White">
        <TelerikInput:RadDatePicker x:Name="Pick" Width="100" Height="20" LostFocus="Pick_LostFocus"         DropDownOpened="Pick_DropDownOpened"></TelerikInput:RadDatePicker>
    </StackPanel>

       private void Pick_LostFocus(object sender, RoutedEventArgs e)
        {
            Pick.IsEnabled = false;
        }

        private void Pick_DropDownOpened(object sender, RoutedEventArgs e)
        {   }

Please help.

Regards,
SivaPrasad.B

3 Answers, 1 is accepted

Sort by
0
SivaPrasad Bevara
Top achievements
Rank 1
answered on 03 Dec 2010, 10:11 AM
Hi,

Thank you, It seems the above problem is fixed in the Q3 release.

But I am facing another problem with the LostFocus event. I am using the Telerik "2010.3.1129.1040" version of controls.

RadDatePicker firing Lost Focus event, when it got focus from another RadDatePicker control.

Following is the code which I am using.

 <StackPanel x:Name="LayoutRoot" Background="White" Orientation="Vertical">
        <TelerikInput:RadDatePicker x:Name="Pick1" Width="100" Height="20" Margin="10,10" LostFocus="Pick_LostFocus"></TelerikInput:RadDatePicker>
        <TelerikInput:RadDatePicker x:Name="Pick2" Width="100" Height="20" Margin="10,10" LostFocus="Pick_LostFocus"></TelerikInput:RadDatePicker>
  </StackPanel>

    private void Pick_LostFocus(object sender, RoutedEventArgs e)
        {  }

Follow the below steps:
Select some date for the first DatePicker. If you tab out from the first control, then it is firing the LostFocus event of Pick1 and Pick2 controls.

Please help.

Regards,
SivaPrasad.B
0
Accepted
Kaloyan
Telerik team
answered on 03 Dec 2010, 03:18 PM
Hello SivaPrasad Bevara,

This is an expected behavior. When you hit the control it gets the focus first and then passes it to the TextBox in it. That is the reason the lost focus appearing. You may need to perform a check if you are still in the control. Unlike WPF in Silverlight there is no such property that can tell you if the focus is somewhere in your control. (WPF - UIElement.IsKeyboardFocusWithin).

All the best,
Kaloyan
the Telerik team
Browse the videos here>> to help you get started with RadControls for Silverlight
0
SivaPrasad Bevara
Top achievements
Rank 1
answered on 06 Dec 2010, 07:38 AM
Hi Kaloyan,
Thank you for the reply.
Regards,
SivaPrasad.B
Tags
DatePicker
Asked by
SivaPrasad Bevara
Top achievements
Rank 1
Answers by
SivaPrasad Bevara
Top achievements
Rank 1
Kaloyan
Telerik team
Share this question
or