I've a got strange situation. I've got a datagrid, and in one of the columns is a datepicker and checkbox. The checkbox if selected will disable the datepicker.
***************************开发者_运维技巧**
* | *
* DatePicker | Checkbox *
* | *
*****************************
I've had a stab at this, and a poke around but can't seem to find where I'd access the datepicker row object to disable it. ItemArray seems to enumerate the column values fine, but I need direct access so I can set IsEnabled
object selected = the_datagrid.SelectedItem;
Why don't you just bind DatePicker.IsEnabled to CheckBox.IsChecked?
It should be possible to poke around in the visual tree to find the DatePicker next to the checkbox that the user clicked. Another solution would be to add a bool property that the checkbox sets if checked and that controls IsEnabled of the DataPicker. The DatePicker and Checkbox should have the same DataContext since they are on the same row.
精彩评论