0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

WPFのDataGridコントロールでIMEを無効にする

Posted at

WPFのDataGridコントロールでDataGridTextColumnを使用しているときに、IMEを無効にしたい場合があります。
DataGridTextColumnのプロパティを調べても、それらしいプロパティが見当たりません。
以下のように、IMEを無効にしたい列のDataGridTextColumn.EditingElementStyleを指定することで、TextBoxInputMethod.IsInputMethodEnabledを設定することができ、IMEを無効にできます。

<DataGrid Name="grid">
    <DataGrid.Columns>
        <DataGridTextColumn Header="アイテム1"/>
        <DataGridTextColumn Header="アイテム2"/>
        <DataGridTextColumn Header="アイテム3" Width="*">
            <DataGridTextColumn.EditingElementStyle>
                <Style TargetType="TextBox">
                    <Setter Property="InputMethod.IsInputMethodEnabled" Value="False"/>
                </Style>
            </DataGridTextColumn.EditingElementStyle>
        </DataGridTextColumn>
    </DataGrid.Columns>
</DataGrid>
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?