OneWay binding throws "TwoWay binding is invalid on Read only property"
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'开发者_JAVA技巧 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
BWIf 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.
精彩评论