GrapeCity SPREAD for WPF 2.0J
CellValidator プロパティ

Column のすべてのセルのデータバリデーターを取得または設定します。
構文
'Declaration
 
Public Property CellValidator As CellValidator
public CellValidator CellValidator {get; set;}

プロパティ値

Column のすべてのセルのバリデーターを指定する CellValidator オブジェクト。既定値は null 参照 (Visual Basicでは Nothing) です。
次のサンプルは GcSpreadGrid をデータソースに連結します。ユーザーが不正な電話番号、または都市名を入力すると、コントロールはエラーチップを表示します。
List<Employee> list = new List<Employee>();
list.Add(new Employee() { Name = "Nancy", City = "Tokyo", Phone = "000-88888888", Age = 30, IsMale = false });
list.Add(new Employee() { Name = "Janet", City = "Sendai", Phone = "000-88888888", Age = 20, IsMale = true });
list.Add(new Employee() { Name = "Rose", City = "Tokyo", Phone = "000-88888888", Age = 40, IsMale = false });
list.Add(new Employee() { Name = "Buchanan", City = "Osaka", Phone = "000-88888888", Age = 20, IsMale = true });
list.Add(new Employee() { Name = "Leverling", City = "Tokyo", Phone = "000-88888888", Age = 30, IsMale = false });
list.Add(new Employee() { Name = "Gavin", City = "Nagoya", Phone = "000-88888888", Age = 40, IsMale = true });
list.Add(new Employee() { Name = "Apple", City = "Osaka", Phone = "000-88888888", Age = 20, IsMale = false });
list.Add(new Employee() { Name = "Tim", City = "Nara", Phone = "000-88888888", Age = 30, IsMale = true });

gcSpreadGrid1.ItemsSource = list;

gcSpreadGrid1.Columns["Phone"].CellValidator = CellValidator.CreateTextLengthValidator(ComparisonOperator.EqualTo, 12, null, "The phone string's length must be 12.");
gcSpreadGrid1.Columns["City"].CellValidator = CellValidator.CreateListValidator("Tokyo, Sendai, Osaka, Nagoya, Nara", "Only 'Tokyo', 'Sendai', 'Osaka', 'Nagoya', 'Nara' are availidate");
Dim list As New List(Of Employee)()
list.Add(New Employee() With { _
    .Name = "Nancy", _
    .City = "Tokyo", _
    .Phone = "000-88888888", _
    .Age = 30, _
    .IsMale = False _
})
list.Add(New Employee() With { _
    .Name = "Janet", _
    .City = "Sendai", _
    .Phone = "000-88888888", _
    .Age = 20, _
    .IsMale = True _
})
list.Add(New Employee() With { _
    .Name = "Rose", _
    .City = "Tokyo", _
    .Phone = "000-88888888", _
    .Age = 40, _
    .IsMale = False _
})
list.Add(New Employee() With { _
    .Name = "Buchanan", _
    .City = "Osaka", _
    .Phone = "000-88888888", _
    .Age = 20, _
    .IsMale = True _
})
list.Add(New Employee() With { _
    .Name = "Leverling", _
    .City = "Tokyo", _
    .Phone = "000-88888888", _
    .Age = 30, _
    .IsMale = False _
})
list.Add(New Employee() With { _
    .Name = "Gavin", _
    .City = "Nagoya", _
    .Phone = "000-88888888", _
    .Age = 40, _
    .IsMale = True _
})
list.Add(New Employee() With { _
    .Name = "Apple", _
    .City = "Osaka", _
    .Phone = "000-88888888", _
    .Age = 20, _
    .IsMale = False _
})
list.Add(New Employee() With { _
    .Name = "Tim", _
    .City = "Nara", _
    .Phone = "000-88888888", _
    .Age = 30, _
    .IsMale = True _
})

gcSpreadGrid1.ItemsSource = list

gcSpreadGrid1.Columns("Phone").CellValidator = CellValidator.CreateTextLengthValidator(ComparisonOperator.EqualTo, 12, Nothing, "The phone string's length must be 12.")
gcSpreadGrid1.Columns("City").CellValidator = CellValidator.CreateListValidator("Tokyo, Sendai, Osaka, Nagoya, Nara", "Only 'Tokyo', 'Sendai', 'Osaka', 'Nagoya', 'Nara' are availidate")
参照

Column クラス
Column メンバ

 

 


Copyright © 2012 GrapeCity inc. All rights reserved.