私はテキストボックスとDataGridを持っています
テキストボックスがフォーカスを失い、DataGrid がフォーカスされていない場合は、DataGrid を非表示にしたいと考えています。
以下のコードを使用します。
Private Sub txt_LostFocus(ByVal sender As Object, ByVal e As System.Windows.RoutedEventArgs) Handles txt.LostFocus
If DataGrid1.IsFocused = False Then
DataGrid1.Visibility = Windows.Visibility.Hidden
End If
End Sub
DataGrid の項目をクリックしても、このコードを使用すると、DataGrid が非表示になります。
私のコードに問題はありますか?