I have a DataGrid in a Silverlight control which contains custom controls. These custom controls are used outside the grid too and work perfectly. When used within the grid however, they appear to reset themselves when focus is lost (i.e. we move to another cell).
To test that it wasn't my custom control, I added a column containing an AutoComplete box. When typing into the box and tabbing to the next column the box is cleared.
When debugging I can see that the controls loaded event is called after we lost focus from it, which confirms that it's being reloaded/recreated when moving to the next field!? Is it simply not committing the change to the grid for some reason?
e.g. of XAML (very basic, nothing weird here)
<sdk:DataGridTemplateColumn Header="Description">
<sdk:DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<sdk:AutoCompleteBox Name="Description" Width="100" />
</DataTemplate>
</sdk:DataGridTemplateColumn.CellTemplate>
</sdk:DataGridTemplateColumn>