バージョン

MaskDataMode プロパティ

データマスキングが有効なときに、データソースによって列のセル値をどのように格納するのかを決める値を取得または設定します。
シンタックス
'宣言
 
Public Property MaskDataMode As Infragistics.Win.UltraWinMaskedEdit.MaskMode
public Infragistics.Win.UltraWinMaskedEdit.MaskMode MaskDataMode {get; set;}
解説

このプロパティは、データソースによってセル値を保存するときに、マスクのリテラルとプロンプト文字がどのように処理されるかを決定します。クリップボードのテキストは、このプロパティの設定に基づいて次のいずれかになります。 すなわち、プロンプト文字もリテラルも一切含まない(生データのみ)、データとリテラルのみを含む、データとプロンプト文字のみを含む、またはプロンプト文字もリテラルも含むテキスト全体のいずれかです。部分的マスク値の書式設定されたスペースは、リテラルをパディングと共に含むよう指定することで保持できます。 この場合、データとリテラル文字は含まれますが、プロンプト文字はスペースに置き換えられます。

通常は raw データがデータソースにコミットされ、データが表示されるときはデータ マスキングを使用して書式設定されます。ただしアプリケーションによっては、データと共にマスクのリテラルも保存する方が適切な場合があります。

列のセルへのデータ入力のマスク方法を指定するときは MaskInput プロパティを使用します。マスクには通常、ユーザーが入力するデータを区切るためのリテラル文字が含まれます。このプロパティは、MaskInput プロパティが設定されている(つまり、データマスキングが有効である)場合以外は効果がありません。

データマスキングを有効にすると、MaskClipMode プロパティによってクリップボードへのセル値のコピー方法を指定できます。また、MaskDisplayMode プロパティによってセル値の表示方法を指定し、PromptChar プロパティによってユーザーにデータ入力を促すプロンプト文字を指定できます。

使用例
Imports Infragistics.Shared
Imports Infragistics.Win
Imports Infragistics.Win.UltraWinGrid

  Private Sub Button17_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles button17.Click

      Dim column As UltraGridColumn = Me.ultraGrid1.DisplayLayout.Bands(0).Columns("Phone")

      ' Enable masked input in a column by setting the MaskInput property.
      column.MaskInput = "(###) ###-####"

      ' Set various mask modes. These mask modes effect how what is included when data
      ' is committed to the cell, when it's displayed and when it's copied. MaskMode of
      ' Raw does not include literals and prompt characters. So for this particular mask,
      ' only thig that is going to be put in the data source will be just the digits, 
      ' Literals will be stripped out (in this example, literals are '(', ')', ' ', '-' 
      ' characters.)
      column.MaskDataMode = MaskMode.Raw
      column.MaskDisplayMode = MaskMode.IncludeBoth
      column.MaskClipMode = MaskMode.IncludeLiterals

      ' PadChar and PromptChar properties effect which characters are used as pad character
      ' and prompt character in masked input cells. Padchar is the character that gets 
      ' substituted in place of an empty character when the MaskMode of 
      ' IncludeLiteralsWithPadding is applied. PromptChar is the character that's used
      ' for prompting. Default for PadChar is ' ' (space character) and for PromptChar is
      ' '_' (an underscore).
      Me.ultraGrid1.DisplayLayout.Bands(0).Columns(0).PadChar = " "
      Me.ultraGrid1.DisplayLayout.Bands(0).Columns(0).PromptChar = "_"

  End Sub
using Infragistics.Shared;
using Infragistics.Win;
using Infragistics.Win.UltraWinGrid;
using System.Diagnostics;

private void button17_Click(object sender, System.EventArgs e)
{

	UltraGridColumn column = this.ultraGrid1.DisplayLayout.Bands[0].Columns["Phone"];

	// Enable masked input in a column by setting the MaskInput property.
	column.MaskInput = "(###) ###-####";

	// Set various mask modes. These mask modes effect how what is included when data
	// is committed to the cell, when it's displayed and when it's copied. MaskMode of
	// Raw does not include literals and prompt characters. So for this particular mask,
	// only thig that is going to be put in the data source will be just the digits, 
	// Literals will be stripped out (in this example, literals are '(', ')', ' ', '-' 
	// characters.)
	column.MaskDataMode    = MaskMode.Raw;
	column.MaskDisplayMode = MaskMode.IncludeBoth;
	column.MaskClipMode    = MaskMode.IncludeLiterals;

	// PadChar and PromptChar properties effect which characters are used as pad character
	// and prompt character in masked input cells. Padchar is the character that gets 
	// substituted in place of an empty character when the MaskMode of 
	// IncludeLiteralsWithPadding is applied. PromptChar is the character that's used
	// for prompting. Default for PadChar is ' ' (space character) and for PromptChar is
	// '_' (an underscore).
	this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].PadChar = ' ';
	this.ultraGrid1.DisplayLayout.Bands[0].Columns[0].PromptChar = '_';

}
参照