Problem with RadDatePicker LostFocus Event.

4 posts, 1 answers
  1. SivaPrasad Bevara
    SivaPrasad Bevara avatar
    73 posts
    Member since:
    Oct 2012

    Posted 30 Nov 2010 Link to this post

    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
  2. SivaPrasad Bevara
    SivaPrasad Bevara avatar
    73 posts
    Member since:
    Oct 2012

    Posted 03 Dec 2010 Link to this post

    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
  3. DevCraft banner
  4. Answer
    Kaloyan
    Admin
    Kaloyan avatar
    920 posts

    Posted 03 Dec 2010 Link to this post

    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
  5. SivaPrasad Bevara
    SivaPrasad Bevara avatar
    73 posts
    Member since:
    Oct 2012

    Posted 06 Dec 2010 Link to this post

    Hi Kaloyan,
    Thank you for the reply.
    Regards,
    SivaPrasad.B
Back to Top