0

さて、誰かがこの例外がこれらの条件で発生する理由を教えてもらえますか?

Test Window

<Window x:Class="MainWindow"
 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
 Title="MainWindow" Height="350" Width="525">
  <StackPanel>
    <ComboBox
        Name="cmbTest"
        IsEditable="True"
        SelectionChanged="ComboBox_SelectionChanged">
    </ComboBox>
  </StackPanel>
</Window>

Code behind

Class MainWindow

  Sub New()
    ' This call is required by the designer.
    InitializeComponent()

    ' Add any initialization after the InitializeComponent() call.
    Dim source As New ObservableCollection(Of String)()
    source.Add("AAA")
    source.Add("BBB")
    source.Add("CCC")
    cmbTest.ItemsSource = source
  End Sub

  Private Sub ComboBox_SelectionChanged(sender As System.Object, e As System.Windows.Controls.SelectionChangedEventArgs)
    Keyboard.Focus(cmbTest)
  End Sub

End Class

ここで、 + を入力AAAしてからCtrl+を入力するとZComboBoxコントロールがこの例外を発生させます。

元に戻すユニットが開いている間は、元に戻すまたはやり直すことはできません。

誰かが理由を説明できますか?!? どうすればそれを回避できるでしょうか?

4

1 に答える 1

0

「Undo メソッドは、KeyPress イベントまたは TextChanged イベントでは機能しません。」これは以前に私を手に入れました。

ソース: http://msdn.microsoft.com/en-us/library/system.windows.forms.textboxbase.undo.aspx

于 2013-04-17T14:39:13.717 に答える