2017-11-08 7 views
-1

IDataErrorInfoを実装するエンティティにバインドされたwpfテキストボックスが作成されました。テキストボックスが無効になっている(IDataErrorInfoの検証に失敗したために赤いボックスが表示される)、テキストボックスのIsEnabledプロパティがfalseに設定されていると、テキストボックスを複数回クリックすると、テキストボックス内のテキストが消去されます(string.Emptyがエンティティへ)。WPF C#テキストボックスIDataErrorInfoバグ - IsEnabled = trueのときに複数回クリックすると、

ここでは何が起こっていますか?これは予想される動作ですか?

編集:isEnabledを削除し、isreadonlyとfocusableを追加しました。テキストボックスをクリックしていないと、検証が失敗した場合、テキストボックスが消去されることに気付きました。

編集:次に、フォーカスを外してもう一度試しました。今回は、検証を表す赤い線を右クリックするまで何も消去されません。

編集:私のテキストボックスは、DataGridTemplateColumn内のDataGridTemplateColumn.CellTemplate内のDataTemplateの内部にあります。

コールスタックは以下の通りです:!

MyCode.DLL MyCode.Models.Entity.PropertyName.set(文字列値)[管理への移行ネイティブ]ライン66のC#
PresentationFramework.dll MS!。 Internal.Data.PropertyPathWorker.SetValue(オブジェクト項目、オブジェクト値)不明 PresentationFramework.dll!MS.Internal.Data.ClrBindingWorker.UpdateValue(オブジェクト値)不明 PresentationFramework.dll!System.Windows.Data.BindingExpression.UpdateSource(object値)不明 PresentationFramework.dll!System.Windows.Data.BindingExpressionBase.UpdateVal ue()Unknown PresentationFramework.dll!System.Windows.Data.BindingExpression.UpdateOverride()Unknown PresentationFramework.dll!System.Windows.Data.BindingExpressionBase.Update()Unknown PresentationFramework.dll!System.Windows.Data.BindingExpressionBase .ProcessDirty()不明 PresentationFramework.dll!System.Windows.Data.BindingExpressionBase.Dirty()不明 PresentationFramework.dll!System.Windows.Data.BindingExpressionBase.SetValue(System.Windows.DependencyObject d、System.Windows.DependencyProperty dp 、オブジェクト値)不明 WindowsBase.dll!System.Windows.DependencyObject.SetValueCommon(System.Windows.DependencyProperty dp、オブジェクト値、System.Windows.PropertyMetadataメタデータ、bool coerceWithDeferredReference、bool coerceWithCurrentValue、System.Windows.OperationType operationType、bool isInternal)未知 WindowsBase.dll!System.Windows.DependencyObject.SetValue(System.Windows.DependencyProperty DP、オブジェクト値)不明 PresentationFramework.dll!System.Windows.Data.BindingExpression.GetInitialValue(System.Windows.DependencyObjectのターゲット、アウトSystem.Windows.Controls.ValidationErrorエラー)不明 PresentationFramework.dll!System.Windows.Data.BindingExpression.Activate(オブジェクトアイテム)不明 PresentationFramework.dll!System.Windows.Data.BindingExpression.AttachToContext(System.Windows.Controls.ValidationErrorエラー) BindingExpression.AttachAttempt attempt)不明 PresentationFramework.dll!System.Windows.Data.BindingExpression.MS.Internal.Data.IDataBindEngineClient.AttachToContext(bool lastChance)不明 PresentationFramework.dll!MS.Internal.Data.DataBindEngine.Task.Runブールラストチャンス)不明 PresentationFramework.dll!MS.Internal.Data.DataBindEngine.Run(オブジェクトarg)不明 PresentationFramework.dll!MS.Internal.Data.DataBindEngine.OnLayoutUpdated(オブジェクト送信者、System.EventArgs e)不明 PresentationCore.dll!System。 Windows.ContextLayoutManager.fireLayoutUpdateEvent()不明 PresentationCore.dll!System.Windows.ContextLayoutManager。UpdateLayout()不明 PresentationCore.dll!System.Windows.UIElement.UpdateLayout()不明 PresentationFramework.dll!System.Windows.Controls.DataGridCell.BeginEdit(System.Windows.RoutedEventArgs e)不明 PresentationFramework.dll!System.Windows .Controls.DataGrid.OnExecutedBeginEdit(System.Windows.Input.ExecutedRoutedEventArgs e)不明 PresentationFramework.dll!System.Windows.Controls.DataGrid.OnExecutedBeginEdit(オブジェクト送信者、System.Windows.Input.ExecutedRoutedEventArgs e)不明 PresentationCore.dll! System.Windows.Input.CommandBinding.OnExecuted(オブジェクト送信者、System.Windows.Input.ExecutedRoutedEventArgs e)不明 PresentationCore.dll!System.Windows.Input.CommandManager.ExecuteCommandBinding(オブジェクト送信者、System.Windows.Input.ExecutedRoutedEventArgs e、 System.Windows.Input.CommandB (CommandBindingを含む) PresentationCore.dll!System.Windows.Input.CommandManager.FindCommandBinding(オブジェクト送信者、System.Windows.RoutedEventArgs、System.Windows.Input.ICommandコマンド、bool実行)不明 PresentationCore.dll!System.Windows .Input.CommandManager.OnExecuted(オブジェクト送信者、System.Windows.Input.ExecutedRoutedEventArgs e)不明 PresentationCore.dll!System.Windows.UIElement.OnExecutedThunk(オブジェクト送信者、System.Windows.Input.ExecutedRoutedEventArgs e)不明 PresentationCore.dll !System.Windows.Input.ExecutedRoutedEventArgs.InvokeEventHandler(System.Delegate genericHandler、object target)不明 PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegateハンドラー、オブジェクトターゲット)不明 PresentationCore.dll!System.Windows .RoutedEventHandlerInfo。 InvokeHandler(オブジェクトターゲット、System.Windows.RoutedEventArgs routedEventArgs)不明 PresentationCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(オブジェクトソース、System.Windows.RoutedEventArgs args、bool reRaised)不明 PresentationCore.dll!System.Windows.UIElement .RaiseEventImpl(System.Windows.DependencyObject sender、System.Windows.RoutedEventArgs args)不明 PresentationCore.dll!System.Windows.UIElement.RaiseEvent(System.Windows.RoutedEventArgs args、bool trusted)不明 PresentationCore.dll!System.Windows .Input.RoutedCommand.ExecuteImpl(オブジェクトパラメーター、System.Windows.IInputElement target、bool userInitiated)不明 PresentationCore.dll!System.Windows.Input.RoutedCommand.Execute(オブジェクトパラメーター、System.Windows.IInputElement target)不明 PresentationFramework。 dll!System.Win dows.Controls.DataGrid.BeginEdit(System.Windows.RoutedEventArgs editingEventArgs)不明 PresentationFramework.dll!System.Windows.Controls.DataGridCell.OnAnyMouseLeftButtonDown(System.Windows.Input.MouseButtonEventArgs e)は不明 PresentationFramework.dll!System.Windows。 System.Windows.Input.MouseButtonEventArgs.InvokeEventHandler(System.Delegate genericHandler、object genericTarget)不明 PresentationCore.dll! Windows.RoutedEventArgs.InvokeHandler(System.Delegateハンドラー、オブジェクトターゲット)不明 PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target、System.Windows.RoutedEventArgs routedEventArgs)不明 Presenta tionCore.dll!System.Windows.EventRoute.InvokeHandlersImpl(オブジェクトソース、System.Windows.RoutedEventArgs引数、ブール値リレイズ)不明 PresentationCore.dll!System.Windows.UIElement.ReRaiseEventAs(System.Windows.DependencyObject送信者、System.Windows。 System.Windows.UIElement.OnMouseDownThunk(Object sender、System.Windows.Input.MouseButtonEventArgs e)Unknown PresentationCore.dll!System.Windows.Input.MouseButtonEventArgs。System.Windows.UIElementから継承されます。 InvokeEventHandler(System.Delegate genericHandler、object genericTarget)不明 PresentationCore.dll!System.Windows.RoutedEventArgs.InvokeHandler(System.Delegateハンドラ、オブジェクトターゲット)不明 PresentationCore.dll!System.Windows.RoutedEventHandlerInfo.InvokeHandler(Object target、System .Windows。System.Windows.UIElement.RaiseEventArms)System.Windows.UIElement.RaiseEventArms(System.Windows.RoutedEventArgs)このイベントを発生させるには、System.Windows.UIElement.RaiseEventArgsを使用します。System.Windows.UIElement.RaiseEventImpl(System.Windows.DependencyObject sender (System.Windows.RoutedEventArgs args)Unknown PresentationCore.dll!System.Windows.UIElement.RaiseTrustedEvent(System.Windows.RoutedEventArgs args) bool trusted)不明 PresentationCore.dll!System.Windows.Input.InputManager.ProcessStagingArea()不明 PresentationCore.dll!System.Windows.Input.InputManager.ProcessInput(System.Windows.Input.InputEventArgs input)不明 プレゼンテーションC ore.dll!System.Windows.Input.InputProviderSite.ReportInput(System.Windows.Input.InputReport inputReport)不明 PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.ReportInput(System.IntPtr hwnd、System.Windows.Input。 (System.Windows.Input.RawMouseActionsの動作、int x、int y、intホイール)不明 PresentationCore.dll!System.Windows.Interop.HwndMouseInputProvider.FilterMessage(System.IntPtr hwnd、MS.Internal.Interop .WindowMessage msg、System.IntPtr wParam、System.IntPtr lParam、ref bool processed)不明 PresentationCore.dll!System.Windows.Interop.HwndSource.InputFilterMessage(System.IntPtr hwnd、int msg、System.IntPtr wParam、System.IntPtr lParam、ref bool扱い)不明 WindowsBase.dll!MS.Win32.HwndWrapper.WndProc(System.IntPtr hwnd、int msg、System.IntPtr wParam、System.IntPtr lParam、refブール処理)Unknow n WindowsBase.dll!MS.Win32.HwndSubclass.DispatcherCallbackOperation(オブジェクトo)不明 WindowsBase.dll!System.Windows.Threading.ExceptionWrapper.InternalRealCall(System.Delegateコールバック、オブジェクトargs、int numArgs)不明 WindowsBase.dll! System.Windows.Threading.ExceptionWrapper.TryCatchWhen(オブジェクトソース、System.Delegateコールバック、オブジェクトargs、int numArgs、System.Delegate catchHandler)不明 WindowsBase.dll!System.Windows.Threading.Dispatcher.LegacyInvokeImpl(System.Windows.Threading .DispatcherPriority priority、System.TimeSpan timeout、System.Delegateメソッド、オブジェクトargs、int numArgs)不明 WindowsBase.dll!MS.Win32.HwndSubclass.SubclassWndProc(System.IntPtr hwnd、int msg、System.IntPtr wParam、System.IntPtr lParam)不明 [AppDomain Transition]

+0

コードを投稿してもよろしいですか? – Hille

+0

@Hille私は今日後でいくつかのコードを投稿しようとします。 – Maderas

答えて

0

理由は分かりませんでしたが、CellTemplateCellEditingTemplateを使用して問題が解決されました。

私の投稿を下落させて逃げた人々には、複雑さを理解できなければ、将来的に質問を無視することをお勧めします。

関連する問題