A cross-platform UI framework for .NET
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 

25 lines
648 B

using System;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
namespace ControlCatalog.Controls
{
public partial class SectionControl : UserControl
{
public SectionControl()
{
InitializeComponent();
}
private void UniformGrid_OnSizeChanged(object? sender, SizeChangedEventArgs e)
{
if (sender is not UniformGrid grid)
return;
const int minItemWidth = 248;
grid.Columns = Math.Max(
1,
(int)((e.NewSize.Width + grid.ColumnSpacing) / (minItemWidth + grid.ColumnSpacing)));
}
}
}