トップ回答者
LightSwitch | DataGrid で Ime を Enabled = false にしたい

質問
-
DataGridTextColumn で編集する際、IME を使えないようにしたいと考えています。
Silverlight では、以下のようにすると可能だということは確認しました。
private void bDataGrid_PreparingCellForEdit(object sender, DataGridPreparingCellForEditEventArgs e) { var el = e.EditingElement; InputMethod.SetIsInputMethodEnabled(el, false); }
では、LightSwitch ではどうやるのでしょう?
上記 e.EditingElement が Silverlight と LightSwitch で異なります。
- Silverlight では TextBox
- LightSwitch では ContentItemPresenter
- 編集済み custar 2012年2月28日 17:00
2012年2月28日 11:54
回答
-
ビジネスタイプの場合でも、デフォルトですと、LightSwitchExtension1.Client プロジェクトのTextBoxの定義を変更すれば良いはずです。
例)
<UserControl x:Class="LightSwitchExtension3.Presentation.Controls.BusinessType1Control"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBox Text="{Binding StringValue, Mode=TwoWay}" InputMethod.IsInputMethodEnabled="False"/>
</UserControl>- 回答としてマーク custar 2012年3月20日 17:07
2012年3月1日 3:03
すべての返信
-
こんにちは。
ざっくりと試してみた感じですと、Extention Tool Kit でコントロールを作り、
Private Sub Control1_Loaded(sender As Object, e As System.Windows.RoutedEventArgs) Handles Me.Loaded
InputMethod.SetIsInputMethodEnabled(TestText1, False)
End Subとすれば、編集可能グリッドなどでは、日本語入力ができなくなります。
ただし、この方法ですと、既存のデータに対しては有効ですが、新規追加する場合には、日本語に切り替え可能となります。
編集時の手当てをしてやればよいのだとは思いますが。そこまでやってません(><)コントロールではなくて、ビジネスタイプでも同じような事ができると思います。ビジネスタイプの方がよさそうな気がします。
2012年3月1日 1:10 -
<UserControl x:Class="LightSwitchExtension1.Presentation.Controls.Control1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBox Text="{Binding StringValue, Mode=TwoWay}" />
</UserControl>デフォルトですと、LightSwitchExtension1.Client プロジェクトが上記のようになっていると思いますので、このTextBoxの定義を変更してやる感じです。
2012年3月1日 2:47 -
ビジネスタイプの場合でも、デフォルトですと、LightSwitchExtension1.Client プロジェクトのTextBoxの定義を変更すれば良いはずです。
例)
<UserControl x:Class="LightSwitchExtension3.Presentation.Controls.BusinessType1Control"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml">
<TextBox Text="{Binding StringValue, Mode=TwoWay}" InputMethod.IsInputMethodEnabled="False"/>
</UserControl>- 回答としてマーク custar 2012年3月20日 17:07
2012年3月1日 3:03 -
"CustomControl" を Silverlight からの持ち込みと解釈していました。
そういえば、LightSwitch にも Extensibility がありましたね。
何回も入れ直している内にすっかり忘れていました。
忘れているので、読み返します。
2012年3月1日 6:21