AvaloniaUI / Avalonia.Controls.ItemsRepeater

ItemsRepeater is a light-weight control to generate and present a collection of items.
MIT License
2 stars 1 forks source link

Item Repeater WrapLayout Throws #24

Open MohamedElhamzawy1993 opened 4 months ago

MohamedElhamzawy1993 commented 4 months ago

Describe the bug

I have a grid of 2 columns and a grid splitter. The second column has an item repeater of borders. When resizing with the grid splitter the app throws a null exception. ItemRepeaterBug.zip

To Reproduce

`

    <!-- (Your content for the first column goes here) -->

    <!-- GridSplitter for resizing -->
    <GridSplitter Grid.Column="1" Width="5" HorizontalAlignment="Center" VerticalAlignment="Stretch" />

    <!-- ItemsRepeater in the Second Column -->
    <ItemsRepeater Name="ItemsRepeater" ItemsSource="{Binding Skills}" Grid.Column="2">
        <ItemsRepeater.Layout>
            <WrapLayout
                Orientation="Horizontal"
                VerticalSpacing="15"
                HorizontalSpacing="15" />
        </ItemsRepeater.Layout>
        <ItemsRepeater.ItemTemplate>
            <DataTemplate>
                <Border BorderBrush="Black"
                        BorderThickness="2"
                        Background="{DynamicResource ArWhite}"
                        Height="80"
                        Width="70">
                </Border>
            </DataTemplate>
        </ItemsRepeater.ItemTemplate>
    </ItemsRepeater>
</Grid>`
` public partial class MainViewModel : ViewModelBase
        {
            public ObservableCollection<int> Skills { get; } = new ObservableCollection<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15 };
        }`

Expected behavior

No response

Avalonia version

11.0.10

OS

Windows

Additional context

No response

MohamedElhamzawy1993 commented 4 months ago

ItemRepeaterBug.zip