question

TobiH77-1803 avatar image
0 Votes"
TobiH77-1803 asked LanHuang-MSFT commented

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

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.

dotnet-aspnet-general
· 1
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

Hi @TobiH77-1803,
Thank you for sharing.
Best regards,
Lan Huang

0 Votes 0 ·

0 Answers