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.
 
 
 

19 lines
510 B

using Avalonia;
using Avalonia.Controls;
namespace Previewer
{
public class Center : Decorator
{
protected override Size ArrangeOverride(Size finalSize)
{
if (Child != null)
{
var desired = Child.DesiredSize;
Child.Arrange(new Rect((finalSize.Width - desired.Width) / 2, (finalSize.Height - desired.Height) / 2,
desired.Width, desired.Height));
}
return finalSize;
}
}
}