GrapeCity SPREAD for WPF 2.0J
Command プロパティ (CheckBoxCellType)

このチェックボックスが押されたときに呼び出すコマンドを取得または設定します。
構文
'Declaration
 
Public Property Command As ICommand
public ICommand Command {get; set;}

プロパティ値

このチェックボックスが押されたときに呼び出すコマンド。既定値は null 参照 (Visual Basicでは Nothing) です。
次のサンプルは CheckBoxCellType のコマンドの使用方法を説明します。
public void SetCheckBoxCommand()
{
    CheckBoxCellType checkbox = new CheckBoxCellType();
    checkbox.TrueContent = "Yes";
    checkbox.FalseContent = "No";
    checkbox.Command = new MyCommand(gcSpreadGrid1);
    gcSpreadGrid1.Columns[1].CellType = checkbox;

}
class MyCommand : ICommand
{
    private GcSpreadGrid _gcSpreadGrid;
    public MyCommand(GcSpreadGrid gcSpreadGrid1)
    {
        this._gcSpreadGrid = gcSpreadGrid1;
    }
    public bool CanExecute(object parameter)
    {
        return true;
    }
    public event EventHandler CanExecuteChanged;
    public void Execute(object parameter)
    {
        CellCommandParameter cellCommandParameter = (CellCommandParameter)parameter;
        if (cellCommandParameter.Area == SpreadArea.Cells)
        {
            MessageBox.Show(this._gcSpreadGrid.ActiveCell.Value.ToString());
        }
    }
}
Public Sub SetCheckBoxCommand()
    Dim checkbox As New CheckBoxCellType()
    checkbox.TrueContent = "Yes"
    checkbox.FalseContent = "No"
    checkbox.Command = New MyCommand(gcSpreadGrid1)
    gcSpreadGrid1.Columns(1).CellType = checkbox

End Sub
Private Class MyCommand
    Implements ICommand
    Private _gcSpreadGrid As GcSpreadGrid
    Public Sub New(gcSpreadGrid1 As GcSpreadGrid)
        Me._gcSpreadGrid = gcSpreadGrid1
    End Sub
    Public Function CanExecute(parameter As Object) As Boolean Implements ICommand.CanExecute
        Return True
    End Function
    Public Event CanExecuteChanged As EventHandler Implements ICommand.CanExecuteChanged
    Public Sub Execute(parameter As Object) Implements ICommand.Execute
        Dim cellCommandParameter As CellCommandParameter = DirectCast(parameter, CellCommandParameter)
        If cellCommandParameter.Area = SpreadArea.Cells Then
            MessageBox.Show(Me._gcSpreadGrid.ActiveCell.Value.ToString())
        End If
    End Sub
End Class
参照

CheckBoxCellType クラス
CheckBoxCellType メンバ

 

 


Copyright © 2012 GrapeCity inc. All rights reserved.