'宣言 Public ReadOnly Property DisplayChars As DisplayCharsCollection
public DisplayCharsCollection DisplayChars {get;}
表示文字のコレクションを返します。マスクを解析すると、結果は各セクションがパート マスクに対応するセクションのコレクションになります。各セクションは順々に DisplayCharBase 派生オブジェクトのコレクションを持ち、それぞれはセクションに関連付けられたマスクの一部のプレースホルダ文字に対応します。DisplayChars は、すべてのセクションからの集合表示文字インスタンスを返します。
これと Sections プロパティの将来的な使用の詳細は、Sections を参照してください。
Private Sub Button1_Click(ByVal sender As Object, ByVal e As RoutedEventArgs) Me.maskedEditor1.StartEditMode() Me.maskedEditor1.Mask = "###-aaa" Me.maskedEditor1.Value = "123-XYZ" Dim sections As SectionsCollection = Me.maskedEditor1.Sections ' The follwing will print out sections. Sections are based on the ' mask. The mask we set above has two edit sections and one ' literal section. Debug.WriteLine("Sections: ") Debug.WriteLine("Sections(0) = " & sections(0).GetType().Name) Debug.WriteLine("Sections(1) = " & sections(1).GetType().Name) Debug.WriteLine("Sections(2) = " & sections(2).GetType().Name) ' Like sections, display characters are also based on mask. ' The following will print out all the display characters. ' It will print out the type of each display character and the ' character value associated with the display character (which ' comes from the Value that we set above). Debug.WriteLine("DisplayChars: ") Dim displayChars As DisplayCharsCollection = Me.maskedEditor1.DisplayChars Dim i As Integer For i = 0 To displayChars.Count - 1 Dim dc As DisplayCharBase = displayChars(i) Debug.WriteLine("DisplayChars(" & i & ") = " & dc.GetType().Name & " '" & dc.Char & "'") Next End Sub
public void button1_Click( object sender, RoutedEventArgs e ) { this.maskedEditor1.StartEditMode( ); this.maskedEditor1.Mask = "###-aaa"; this.maskedEditor1.Value = "123-XYZ"; SectionsCollection sections = this.maskedEditor1.Sections; // The follwing will print out sections. Sections are based on the // mask. The mask we set above has two edit sections and one // literal section. Debug.WriteLine( "Sections: " ); Debug.WriteLine( "Sections[0] = " + sections[0].GetType( ).Name ); Debug.WriteLine( "Sections[1] = " + sections[1].GetType( ).Name ); Debug.WriteLine( "Sections[2] = " + sections[2].GetType( ).Name ); // Like sections, display characters are also based on mask. // The following will print out all the display characters. // It will print out the type of each display character and the // character value associated with the display character (which // comes from the Value that we set above). Debug.WriteLine( "DisplayChars: " ); DisplayCharsCollection displayChars = this.maskedEditor1.DisplayChars; for ( int i = 0; i < displayChars.Count; i++ ) { DisplayCharBase dc = displayChars[i]; Debug.WriteLine( "DisplayChars[" + i + "] = " + dc.GetType( ).Name + " '" + dc.Char + "'" ); } }