0
votes

I've got a Silverlight user control that contains a datagrid. The datagrid is bound to an ObservableCollection. The user control is displayed in a popup window that I show in response to some event in another control

There are about 80 objects in the collection, and I've set a fixed height of 400 on the datagrid, so only about 20 items can be shown at one time, and the vertical scrollbar should be shown, with a thumb size occupying about 1/4th of the control height.

However, what's actually happening is that the scrollbar occupies almost the whole control height; maybe 95% of it. The datagrid displays the first 20 items. When I click on the scrollbar down arrow, the scrollbar moves down a little to occupy the bottom 95% of the scroll area, and the datagrid displays the last 20 items.

It gets weirder. If I move over the items in the grid and scroll down using the mouse wheel, then the items scroll correctly and I can view the whole list, although the scrollbar remains the same size.

And then, if I close the popup and reopen it, the scrollbar now appears with the correct height and it works correctly.

Finally, if I just show the control directly on the page, and not in a popup, it works fine. What's going on here?! Has anyone else run into this problem? Help!

Update: The problem seems to be the way that I'm showing the popup. For various reasons, I had to implement the popup display in a somewhat tricky way, and it's this that's causing the trouble.

1
can you isolate the problem and post the xaml and code? (without the 80 row data objects) - herzmeister
Not readily, but as I was trying to, I got closer to the source of the problem (see update), so danke schoën for the suggestion. - Joshua Frank
I'm seeing the same issue, but not in a Popup or ChildWindow. When the user chooses an item to load, the DataGrid gets loaded with potentially thousands of rows, and the user can't scroll through them easily. Joshua: what did you do to fix this issue? It might be related to the DataGrid's container, but not necessarily specific to Popup. - user362929
@Zack: I never really got to the bottom of the problem, and I didn't have a virtualized grid, since I only needed to display a dozen or so rows. I was displaying the grid in a popup, and I had to explicitly reset the DataContext, because I was moving the popup from one page to another. Long story. Anyway, I never had this problem when just using a grid on a page in the orthodox way, so I'm not sure how much I can help you. - Joshua Frank

1 Answers

0
votes

I recoded this, removing some crufty stuff, and the problem went away; see my update. This isn't really a solution as such, but I wanted to close out the question for the record.