views:

418

answers:

1

Hello,

I have a datagrid with some TextColumn and one DataGridCheckBoxColumn. I bind it with à itemsource that contaned à boolean and i can see that my checkboxes or checked or not by the boolean everything is OK at this point.

but the checkboxs cells are in ReadOnly even if i assigne IsReadOnly = False. I cant find the right and clean way to enable the editing.

I dont need data validation but juste to be able to edit and check those checkboxes :)

alt text

If anyone can help! thanks !!

+1  A: 

Is the binding mode set to TwoWay on the DataGridCheckBoxColumn ?

This code works for me.

<data:DataGrid Grid.Row="1" Width="600" MaxHeight="200"
    GridLinesVisibility="Horizontal"
    AutoGenerateColumns="False" VerticalScrollBarVisibility="Auto"
    HorizontalScrollBarVisibility="Auto" 
    ItemsSource="{Binding Path=ProductPull.Items, Mode=OneWay}">
        <data:DataGrid.Columns>
            <data:DataGridCheckBoxColumn Header="Select" 
                Binding="{Binding Path=IsSelected, Mode=TwoWay}" />

EDIT

From Silverlight Data Binding here are the binding modes:

    Direction of the Data Flow
    --------------------------------------------------------------------------------

    Each binding has a Mode property, which determines 
how and when the data flows. Silverlight enables three types of bindings:

    OneTime bindings update the target with the 
source data when the binding is created.

    OneWay bindings update the target with the 
source data when the binding is created and anytime the data changes. 
This is the default mode.

    TwoWay bindings update both the target and the
source when either changes. Alternately, you can disable 
automatic source updates and update the source only at times of your choosing.

    In order for automatic target updates to occur, 
the source object must implement the INotifyPropertyChanged interface, 
as described in the next section.
DaveB
What is the difference between the Mode?
Polo
@Polo - I have amended my answer to include the binding modes.
DaveB