Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

When DataGrid is not set to a height, dynamically adding rows will not widen the height #16016

Closed
mfkwgizhoujian opened this issue Jun 13, 2024 · 4 comments
Labels
by-design The behavior reported in the issue is actually correct.

Comments

@mfkwgizhoujian
Copy link

Describe the bug

When I was using DataGrid, I did not set the height, and the set for initializing the binding was empty. By clicking the button to add rows, there was data in the set, but it did not expand the height of the DataGrid, which led me to think that there was a problem with the binding at one point.

image

To Reproduce

  1. Create a DataGrid normally
  2. Add a button
  3. Add a click event to the button and add data to the ObservableCollection object bound to the DataGrid through the Add method

Expected behavior

When dynamically adding data, if the height of the DataGrid is not set, it should automatically expand to display the latest data

Avalonia version

11.0.10

OS

Windows, macOS

Additional context

No response

@workgroupengineering
Copy link
Contributor

workgroupengineering commented Jun 13, 2024

 <StackPanel>
     <Button Content="Add"/>
     <DataGrid  ScrollViewer.VerticalScrollBarVisibility="Disabled">
     </DataGrid> 
 </StackPanel>

For next , open the discussion before open the issue.

@mfkwgizhoujian
Copy link
Author

image
iShot_2024-06-13_19.18.52.mp4

I added this code: ScrollViewer.VerticalScrollBarVisibility="Disabled", only adding the first piece of data can automatically display the data, and the rest cannot be extended unless scrolling the mouse over the table

@workgroupengineering
Copy link
Contributor

Maybe there's a problem with your theme. With the fluent theme it seems to work.

eg: TAGrid.zip

@timunie
Copy link
Contributor

timunie commented Jun 13, 2024

DataGrid needs fixed height to work as inteneded. StackPanel doesn't provide it. Either set height on your own or use a Grid or DockPanel.

@timunie timunie added by-design The behavior reported in the issue is actually correct. and removed bug labels Jun 13, 2024
@AvaloniaUI AvaloniaUI locked and limited conversation to collaborators Jun 13, 2024
@timunie timunie converted this issue into discussion #16022 Jun 13, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
by-design The behavior reported in the issue is actually correct.
Projects
None yet
Development

No branches or pull requests

3 participants