RE: Datagrid Horizontal scroll bar not get visible when binded to datatable has more columns and no rows

TobiH77 1 Reputation point
2021-08-28T09:32:45.017+00:00

my solution to this question:

https://social.msdn.microsoft.com/Forums/vstudio/en-US/ee89e8ca-6c20-4289-ad62-865194599fcb/datagrid-horizontal-scroll-bar-not-get-visible-when-binded-to-datatable-has-more-columns-and-no-rows?forum=wpf

make sure your DataGrid has CanUserAddRows enabled so the ScrollBar is visible and create a converter for DataGrid.RowHeight. Create a binding in RowHeight and set height to 0 if Items.Count in your DataGrid collection is 0.

Another solution is to switch between two DataGrids and show a different Grid when Items.Count is 0.

Developer technologies ASP.NET Other
{count} votes

Your answer

Answers can be marked as Accepted Answers by the question author, which helps users to know the answer solved the author's problem.