Quantcast
Channel: Windows Presentation Foundation (WPF) forum
Viewing all articles
Browse latest Browse all 18858

FocusNavigationDirection is not working in WPF DatePicker

$
0
0

Dear Experts,

Below code is working very fine but not working in DatePicker

What is the issue behind  

--------------------------------------------------------------------------------

 Private Sub frmgoodsrecp_KeyDown(sender As Object, e As KeyEventArgs) Handles Me.KeyDown
        Dim source As TextBox = TryCast(e.Source, TextBox)
        If e.Key = Key.F2 Or e.Key = Key.Enter Then
            Try
                If e.Key = Key.F2 Then
                    source.Clear()
                End If
                Dim k As New KeyEventArgs(Keyboard.PrimaryDevice, Keyboard.PrimaryDevice.ActiveSource, System.Environment.ProcessorCount, Key.Tab)
                k.RoutedEvent = UIElement.KeyDownEvent
                source.[RaiseEvent](k)
                k.RoutedEvent = UIElement.KeyUpEvent
                source.[RaiseEvent](k)
            Catch ex As Exception
            End Try
        End If

        If e.Key = Key.Enter Then
            Dim uie = TryCast(e.OriginalSource, UIElement)
            e.Handled = True
            uie.MoveFocus(New TraversalRequest(FocusNavigationDirection.[Next]))
        End If

------------------------------------------------------------

Xaml Code for Datepicker

--------------------------------------------------------------------------------

<DatePicker x:Name="txt_VOUDT" HorizontalAlignment="Left" Margin="523,39,0,0" VerticalAlignment="Top" Width="100"  Height="26"  SelectedDate="{x:Static System:DateTime.Now}" SelectedDateFormat="Short" TabIndex="6"/>


Thanks & Regards Manoj Patel


Viewing all articles
Browse latest Browse all 18858

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>