DataGridBoolColumn.TrueValue 属性

定义

获取或设置在将列值设置为 true 时使用的实际值。

public:
 property System::Object ^ TrueValue { System::Object ^ get(); void set(System::Object ^ value); };
[System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter))]
public object TrueValue { get; set; }
[<System.ComponentModel.TypeConverter(typeof(System.ComponentModel.StringConverter))>]
member this.TrueValue : obj with get, set
Public Property TrueValue As Object

属性值

Object

类型为 Object 的值。

属性

示例

下面的代码示例设置 TrueValuea DataGridBoolColumn的 、FalseValue属性和NullValue属性。

private:

   void SetBoolColumnValues()
   {
      DataGridBoolColumn^ myGridColumn;
      
      // Get the DataGridBoolColumn you are setting.
      myGridColumn = dynamic_cast<DataGridBoolColumn^>(myDataGrid->TableStyles[ "Customers" ]->GridColumnStyles[ "Current" ]);
      
      // Set TrueValue, FalseValue, and NullValue.
      myGridColumn->TrueValue = true;
      myGridColumn->FalseValue = false;
      myGridColumn->NullValue = Convert::DBNull;
   }
private void SetBoolColumnValues(){
   DataGridBoolColumn myGridColumn;
   // Get the DataGridBoolColumn you are setting.
   myGridColumn = (DataGridBoolColumn) myDataGrid.
   TableStyles["Customers"].GridColumnStyles["Current"];
   // Set TrueValue, FalseValue, and NullValue.
   myGridColumn.TrueValue = true;
   myGridColumn.FalseValue = false;
   myGridColumn.NullValue = Convert.DBNull;
}
Private Sub SetBoolColumnValues()
   Dim myGridColumn As DataGridBoolColumn 
   ' Get the DataGridBoolColumn you are setting.
   myGridColumn = CType(myDataGrid.TableStyles _
   ("Customers").GridColumnStyles("Current"), DataGridBoolColumn)
   ' Set TrueValue, FalseValue, and NullValue.
   myGridColumn.TrueValue = true
   myGridColumn.FalseValue = false
   myGridColumn.NullValue = Convert.DBNull
End Sub

注解

FalseValueNullValueTrueValue属性确定推送到数据源的实际值。

适用于

另请参阅