作成日: 2022/04/18 最終更新日: 2022/04/18
文書種別
制限事項
詳細
数値型に設定したセルに全角の文字列(IME変換時の文字)が表示されます。
ただし、確定時に入力はされません。
回避方法
以下は、Edit_Began・Editor_Loaded・Text_Changedイベントで入力値をチェックする例です。
◎サンプルコード(VB)
Private Sub Edit_Began(sender As Object, e As C1.WPF.DataGrid.DataGridBeganEditEventArgs)
If TypeOf e.EditingElement Is C1NumericBox Then
Dim txtBox As C1NumericBox = CType(e.EditingElement, C1NumericBox)
AddHandler txtBox.Loaded, AddressOf Editor_Loaded
End If
End Sub
Private Sub Editor_Loaded(sender As Object, e As RoutedEventArgs)
Dim txtBox As C1NumericBox = CType(sender, C1NumericBox)
Dim temp = CType(txtBox.Template.FindName("Text", txtBox), C1TextBoxBase)
AddHandler temp.TextChanged, AddressOf Text_Changed
End Sub
Private Sub Text_Changed(sender As Object, e As TextChangedEventArgs)
Dim txtBox As C1TextBoxBase = CType(sender, C1TextBoxBase)
Dim result As Double
If (Double.TryParse(txtBox.Text, result)) = False Then
txtBox.Text = "0"
End If
End Sub