Some Rows Have Row Headers, Some Do Not

Nov 24, 2009 at 10:13 AM
Edited Nov 24, 2009 at 5:35 PM

Hi all,

I have a problem whereby some rows on my DataGrid have row headers and some do not, which also causes the rows with headers to be offset. There are not supposed to be any row headers at all. Please see these mock-ups: Correct and Incorrect. (Whilst the error occurs frequently it is not fully repeatable, and I have been unable to get it to occur whilst trying to get a screenshot!)

I suspect the problem may occur because the DataGrid's content sometimes updates at the same time as the FrameworkElement that contains it is either moved, it's visibility changed or its parent changed to a different FrameworkElement.

Perhaps I can work around the problem with calls to BeginInit() or EndInit(), or by forcing the DataGrid to redraw. Unfortunately I am not sure when to do either of these (the DataGrid relies heavily on databinding, so it may be when the binding sources are changed that the DataGrid experiences this problem), so any guidance would be greatly appreciated.

EDIT: Additionally, there is a multibinding that changes the opacity of the foreground of each column dependant upon whether or not the Show value (the first column) for the corresponding object (row) is set to true; if it is set to false the opacity is set to 0.5, otherwise the opacity is unchanged (it has the default value, which appears to be 1.0 in most cases). However, I have noticed that any erroneous rows (those with row headers and that are offset) do not have this opacity applied for the second column ("Channel (Current)"), however it is still applied correctly for the remaining columns. Perhaps this information may also be of use.