I have a Silverlight datagrid with custom code that allows +/- on the left side and can display a table with a tree structure. The +/- buttons are tied to the IsExpanded property on my ViewModelRows, as I call them. String visibility is tied to the IsVisible property in ViewModelRows, which is determined based on whether all parent rows are expanded. Simple enough.
This code works great if I scroll up and down the grid using PageUp / PageDown or the arrow keys, all the correct lines are hidden, and everything has the correct structure, and I can play with the +/- buttons for my heart. However, the vertical scroll bar on the right side, although it starts at the correct size, and it smoothly scrolls through the lines when I collapse the lines and then expand them again, does not return to the correct size.
The scrollbar still usually moves to scroll through the entire collection, but since it is too large as soon as the panel moves to the bottom, there are a few more lines that you can go through and it looks like a jerk all the way to the bottom or sometimes it doesn't scroll at all. It's pretty hard to describe, so I included a screenshot with black lines drawn to show the difference in the length of the scroll bar, although the two grids have the same number of lines.
I think this might be a bug related to the way Datagrid does row virtualization. It seems to me that it does not correctly track how high each line is, as expected, when changing the extension states. Is there a way to programmatically “push” (read the hack) to recount the size of the scrollbar on LoadRow or something ugly? I would include a sample code, but there were 2 C # files and 1 xaml file, so I wanted to see if anyone else had heard of this issue before trying to make it playable offline. Once again, scrolling with the arrow keys works fine, so I'm sure the main logic and binding work, there is only some problem with the line height, which is not calculated properly.
Since I am a new user, he will not allow me to use image tags, so here is the link to the problem image:
http://img210.imageshack.us/img210/8760/messedupscrollbars.png
Luke vilnis
source
share