How to control the number of allowed flag states?

I am using silverlight 4 toolkit gridcontrol and I am using automatically generated columns. My boolean field appears as a tri-state flag (true, false, null).

public bool? Enabled { get; set; }

How to make it use only two states (true / false). Changing the field type is currently not an option.

@Bala

[Xaml]

<sdk:DataGrid Grid.Row="1" Grid.Column="1" x:Name="liveGrid" 
HorizontalAlignment="Center"
VerticalScrollBarVisibility="Hidden"  HorizontalContentAlignment="Center"
ItemsSource="{Binding MyDatasource}" AutoGenerateColumns="True" />

Just a thought: is there an annotation for UIHint data for this, maybe?

Possible Solution

Following @Rick I have a working solution:

[Xaml]

<sdk:DataGrid Grid.Row="1" Grid.Column="1" x:Name="liveGrid" 
HorizontalAlignment="Center"
VerticalScrollBarVisibility="Hidden"  HorizontalContentAlignment="Center"
AutoGeneratingColumn="viewModel_AutoGeneratingColumn" 
ItemsSource="{Binding MyDatasource}" AutoGenerateColumns="True" />

[View]

 private void viewModel_AutoGeneratingColumn(object sender, DataGridAutoGeneratingColumnEventArgs e)
    {
        if ("Enabled" == e.PropertyName)
        {
            DataGridCheckBoxColumn checkBox = e.Column as DataGridCheckBoxColumn;
            checkBox.IsThreeState = false;
        }
    }
+3
source share
1 answer

. , , :

DataGrid.AutoGeneratingColumn.

, , , (, ) IsThreeState false:

+1

All Articles