Hello,
I put a datagrid in a window. The size of the window is smaller than the size of the datagrid, but there is no scrollbar turned on automatically.
How could I turn on the scrollbar?
Thanks.
Check the layout properties for the XamDataGrid in your layout. Is it in a Grid? Is the Grid set to Auto Size Width and Height and Vertical and Horizontal Alignment set to Stretch? Are those same properties for the XamDataGrid also set to Width=Auto and Height=Auto and VerticalAlignment=Stretch and HorizontalAlignment=Stretch. These are the default settings. So if your XAML does not have any of these properties set, then you should be OK.
If the element is set to be positioned VerticalAlignment to Top and HorizontalAlignment to Left, then the element (such as the XamDataGrid) will span to the right and to the bottom. However, if they are set to Stretch with Auto Width and Height, the grid will span to fit its container. And the scrollbars will automatically appear.
Additionally, make sure that VerticalScrollbarVisibility and HorizontalScrollbarVisibility are set to Auto or Visible (or not set at all in your XAML).
If this does not solve your issue, paste the XAML here that we might see what is going on.
Thanks!
Hi
Did you manage to resolve this issue ? Did the solution provided by Curtis help ? Let me know if you have further questions. Thanks.
Thanks for your reply.
I must use canvas, because I need to use overlay to make the group headings to rotate above the XamDataGrid. I found canvas is the only way to make overlay. If you know another solution, please let me know.
I have tried to hard code the Width and Height for the XamDataGrid, the scrollbars appeared for the XamDataGrid. But the scrollbars didn't apply to the group headings. I developed my group headings control, because I couldn't merge the cells in XamDataGrid. Is there any way to apply the scrollbars to both XamDataGrid and group headings?
To have items overlay each other, you can either give them a negative margin, or apply a TranslateTransform in the RenderTransform property. So if you have an item above another in a Grid or StackPanel and you need it to overlay the item below it, give that item a negative bottom margin or offset the Y TranslateTransform with a positive number.
As far as the scrollbars and the XamDataGrid Group Headers issue, would you provide a screenshot of what you are seeing and what you wish the desired results to be?
Thank you!
Please find the current screenshot attached. The screenshot is using some of your sample data.
As you can see from the screenshot, the horizontal scrollbar only applies to the datagrid. I need the group headings (ID, PersonalDetails, and PayPackage) to be sync with the labels. So, I need the horizontal scrollbar to apply to the group headings as well.
There is a built-in way in the grid to achieve what you are doing. Please see the below blog post :-
http://blogs.infragistics.com/blogs/alex_fidanov/archive/2010/06/02/howto-common-headers-in-the-xamdatagrid.aspx
This should resolve your issue.
Thanks. This resolved the scrollbar and cell merge problems.