This thread looks to be a little on the old side and therefore may no longer be relevant. Please see if there is a newer thread on the subject and ensure you're using the most recent build of any software if your question regards a particular product.
This thread has been locked and is no longer accepting new posts, if you have a question regarding this topic please email us at email@example.com
The attached is the screen shots and reproducing project.
1) Run the application
2) Click on MoreProblem button, new window will come out
3) Click "Delete" button, you will see there is white separate line on last column header as circled in red on attached image SeparateLine.jpg, which is not good
4) Click on "Insert" button 4 times, the last column's data disappears and scroll bar is shown, see attached image LastColumnDataDisappeared.Jpg
5) Click "Insert" button again, the data grid looks normal again, as Normal.jpg
It looks bad on our application, please fix them...
Thanks a lot, Gordon
The best solution to this issue would be to always show the vertical scroll bar. Here is some xaml code that can be placed within a resource dictionary that will achieve this.
Solving the actual problem poses the risk of introducing an infinite loop. When the scroll bar visibilities are auto, then whether or not they get displayed is not known until after the rows of the grid has been measured. If the vertical scroll bar is not displayed, then the rows will be measured to fill the space where the scroll bar normally is. After this is measured, the scroll viewer works out that the vertical scroll bar should be displayed, but this gets put over the top of the rows - hiding the data in the last column. Similar issue occurs when measuring while the scroll bars are displayed, but then resulting in the scroll bars not being displayed - this causes the white line and extra 'column'. The rows would need to be re-measured after the visibility of the scroll bar is known, but as this is all happening within a measure pass, we can't cause a re-measure. Re-measuring during a measure pass can be bad. In the early days of our DataGrid, we had done this which resulted in an infinite loop occurring which you may remember you found. So always having the vertical scroll bar visible when star-sizing columns are present is the safest solution.
Hope that helps.