1

DatePickerWPF内で挿入キーを有効にするにはどうすればよいですか?

<DatePicker x:Name="DateTpicker"
              SelectedDate="{x:Static sys:DateTime.Now}"
              DisplayDate="{x:Static sys:DateTime.Now}"
              PreviewTextInput="ActivateInsertKey"/>

private void ActivateInsertKey()
{
    // activate Insert-key ?????
}
4

1 に答える 1

0

ここで解決策を見つけました(最後の投稿を参照):

PropertyInfo textEditorProperty = typeof (TextBox).GetProperty(
   "TextEditor", BindingFlags.NonPublic | BindingFlags.Instance);
object textEditor = textEditorProperty.GetValue(hexTextBox, null);

// set _OvertypeMode on the TextEditor
PropertyInfo overtypeModeProperty = textEditor.GetType().GetProperty(
   "_OvertypeMode", BindingFlags.NonPublic | BindingFlags.Instance);
overtypeModeProperty.SetValue(textEditor, true, null);

コードビハインドとCopy/Pasted上記のコードでメソッドを作成しました。

于 2013-04-16T10:22:17.037 に答える