Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
975
XamGrid -> Sizing issue when data source has no items
posted

Hello,

I have run into a situation with the xamGrid where I don't think it is behaving correctly. I have attached an example which demonstrates the issue.

1) Open attached solution and build/run

2) You will see I have two grid columns specified, the first column contains a xamGrid and the second column contains some other content.

3) The xamGrid is configured to display 5 text columns, and currently the items source has two rows and everything displays as expected.

4) Now, go to the MainWindow.xaml.cs and comment out line 50. This will cause the items source passed into the xamGrid to be empty.

5) Re-build, run. Now you will see that the xamGrid does not display correctly, in fact it's calculated width is now only 2 pixels. This is not what I would expect, I would expect to see the xamGrid displaying it's text columns even if there are no rows to display.

Can you please investigate whether this is a bug or by design?

Thank you.

-Chris

xamGridSizeTest.zip
Parents
No Data
Reply
  • 34810
    Verified Answer
    Offline posted

    Hello Chris,

    I believe that this issue is a bug in the XamGrid control. The XamGrid appears to auto-size to the width of the RowsPanel, which includes the header row. The headers are drawn, but this resizing of the RowsPanel remains at zero, causing the grid to only render to about 2 pixels wide. In order to workaround this, I would recommend that you set the Width property of your XamGrid whenever the underlying ItemsSource is empty, and when it populates, set the Width to double.NaN, as this should cause it to auto-size again.

    I have asked our engineering staff to examine this a bit further. To ensure it receives attention, I have logged development issue 231727 in our internal tracking systems. I have also created you a support case for this, which I will link to this development issue. This case has an ID of CAS-180844-B2L5Q2, and you can access it by logging into your account and visiting https://es.infragistics.com/my-account/support-activity.

    Please let me know if you have any other questions or concerns on this matter.

    Sincerely,
    Andrew
    Associate Developer

Children