AvaloniaUI / Avalonia

Develop Desktop, Embedded, Mobile and WebAssembly apps with C# and XAML. The most popular .NET UI client technology
https://avaloniaui.net
MIT License
25.79k stars 2.23k forks source link

Control Expand (Width) Failur -> Measure/Arrange #17150

Open trashhacker opened 1 month ago

trashhacker commented 1 month ago

Describe the bug

Measure or Arange bug... Grid or content is expanding to far Screenshot 2024-09-27 172924

To Reproduce

https://github.com/trashhacker/Avalonia.Repro.git

Expected behavior

datagrid or grid schould not expand to right site that much !!

Avalonia version

11.1.0

OS

No response

Additional context

No response

maxkatz6 commented 1 month ago

Is this a datagrid specific bug or can you reproduce it with any other control?

trashhacker commented 1 month ago

Screenshot 2024-09-30 221453 i also have this seems like the grid is broken in some way

<Grid>
  <Grid.ColumnDefinitions>
    <ColumnDefinition Width="Auto" MinWidth="200"/>
    <ColumnDefinition Width="5"/>
    <ColumnDefinition Width="*"/>
  </Grid.ColumnDefinitions>
  <Grid.RowDefinitions>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="Auto"/>
    <RowDefinition Height="*"/>
  </Grid.RowDefinitions>

  <DatePicker Grid.Column="0" Grid.Row="0" SelectedDate="{Binding StartDate}" />

  <DataGrid Grid.Column="0" Grid.Row="1" ItemsSource="{Binding Shifts.Collection.Values}" AutoGenerateColumns="False" MinHeight="200">
    <DataGrid.Columns>
      <DataGridTextColumn Header="{res:Token shift}" Binding="{Binding Section, Mode=OneWay, Converter={StaticResource shiftsectionconverter}}"/>
      <DataGridTextColumn Header="{res:Token start}" Binding="{Binding Start, Mode=OneWay, Converter={StaticResource shifttimeconverter}}"/>
      <DataGridTextColumn Header="{res:Token end}" Binding="{Binding End, Mode=OneWay, Converter={StaticResource shifttimeconverter}}"/>
      <DataGridCheckBoxColumn Header="" Binding="{Binding Selected, Mode=TwoWay}" IsReadOnly="False"/>
    </DataGrid.Columns>
  </DataGrid>

  <DataGrid Grid.Column="0" Grid.Row="2" ItemsSource="{Binding EmployeeSelector.Collection.Values}" AutoGenerateColumns="False" >
    <DataGrid.Styles>
      <Style Selector="DataGridRow">
        <Setter Property="(i:Interaction.Behaviors)">
          <i:BehaviorCollectionTemplate>
            <i:BehaviorCollection>
              <behaviors:DragBehavior  />
            </i:BehaviorCollection>
          </i:BehaviorCollectionTemplate>
        </Setter>
      </Style>
    </DataGrid.Styles>
    <DataGrid.Columns>
      <DataGridTextColumn Header="{res:Token firstname}" Binding="{Binding Firstname}"/>
      <DataGridTextColumn Header="{res:Token lastname}" Binding="{Binding Lastname}"/>
      <DataGridTextColumn Header="{res:Token shfits}" Binding="{Binding ShiftSections, Mode=OneWay, Converter={StaticResource shiftarrayconverter}}"/>
      <DataGridCheckBoxColumn Header="" Binding="{Binding Selected, Mode=TwoWay}" IsReadOnly="False"/>
    </DataGrid.Columns>
  </DataGrid>

  <controls:ShiftSheduleControl Grid.Column="2" Grid.Row="0" Grid.RowSpan="2" Weeks="{Binding Weeks}"/>
</Grid>