WPF datagrid row horizontal alignment issue

alignment, wpf, wpfdatagrid, xaml

Solution

This issue is caused by row headers being "shown" for some random rows.

I don't know why it happens, but fortunately the fix is simple.

If you set `RowHeaderWidth="0"` on the DataGrid, the behavior should be as expected.

For some reason the row headers are still making an appearance even though `HeadersVisibility` is set to Column.

Problem

I'm using a DataGrid in a form to show a list of (userID, name, balances, etc.). There is a very strange issue with it, at the beginning of some rows (one out of very twenty rows) there is a small white space that is causing that row to be misaligned. The white space is like a little rectangle that is placed right before the first cell of the row. I reviewed my styles and everything but cannot figure out why this is happening. This happens only when I programmatically scroll my DataGrid, after the scroll is done the white spaces appear. What makes things worse is that the white space is resizable! and when I resize it with my mouse it screws up the grid. I really don't want to ship something like this out. I don't have much experience in WPF, I would really appreciate it if someone could give me some idea about where to look. Thanks. Edit: Here is the screenshot:

Original source