views:

176

answers:

1

This binding

<tk:DataGridTextColumn Binding="{Binding Path=Id, Mode=OneWay}" 
Header="Sale No." Width="1*" />

Gives this error

A TwoWay or OneWayToSource binding cannot work on the read-only property 'Id' of type . . .

The "Id" property is indeed readonly, I thought though that Mode=OneWay would be sufficient.

I'm tired and I know I'm missing something obvious so I'll apologies now for asking a really dumb question.

Thanks
BW

+2  A: 

If I recall correctly, I think that the DataGridTextColumn stomps on your Binding.Mode when it generates the editing element because the column itself still defaults to being read/write if the DataGrid is editable. Try setting IsReadOnly="true" on the DataGridTextColumn.

Josh Einstein
You are a gentleman sir and a prince among men! I looked for a "readonly" property, still don't have my head around WPF's properly named properties. Thanks a million Josh :)
Binary Worrier