Revert "File scoped namespaces"

This reverts commit d31d8f574e.
This commit is contained in:
Burak Kaan Köse
2025-02-16 11:43:30 +01:00
parent d31d8f574e
commit cf9869b71e
617 changed files with 32097 additions and 31478 deletions

View File

@@ -2,85 +2,86 @@
using Windows.UI.Xaml;
using Windows.UI.Xaml.Controls;
namespace Wino.Core.UWP.Controls;
public partial class EqualGridPanel : Panel
namespace Wino.Core.UWP.Controls
{
public int Rows
public partial class EqualGridPanel : Panel
{
get { return (int)GetValue(RowsProperty); }
set { SetValue(RowsProperty, value); }
}
public static readonly DependencyProperty RowsProperty =
DependencyProperty.Register(
nameof(Rows),
typeof(int),
typeof(EqualGridPanel),
new PropertyMetadata(1, OnLayoutPropertyChanged));
public int Columns
{
get { return (int)GetValue(ColumnsProperty); }
set { SetValue(ColumnsProperty, value); }
}
public static readonly DependencyProperty ColumnsProperty =
DependencyProperty.Register(
nameof(Columns),
typeof(int),
typeof(EqualGridPanel),
new PropertyMetadata(1, OnLayoutPropertyChanged));
private static void OnLayoutPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
if (d is EqualGridPanel panel)
public int Rows
{
panel.InvalidateMeasure();
panel.InvalidateArrange();
}
}
protected override Size MeasureOverride(Size availableSize)
{
if (Rows <= 0 || Columns <= 0)
{
return new Size(0, 0);
get { return (int)GetValue(RowsProperty); }
set { SetValue(RowsProperty, value); }
}
double cellWidth = availableSize.Width / Columns;
double cellHeight = availableSize.Height / Rows;
public static readonly DependencyProperty RowsProperty =
DependencyProperty.Register(
nameof(Rows),
typeof(int),
typeof(EqualGridPanel),
new PropertyMetadata(1, OnLayoutPropertyChanged));
foreach (UIElement child in Children)
public int Columns
{
child.Measure(new Size(cellWidth, cellHeight));
get { return (int)GetValue(ColumnsProperty); }
set { SetValue(ColumnsProperty, value); }
}
return availableSize;
}
public static readonly DependencyProperty ColumnsProperty =
DependencyProperty.Register(
nameof(Columns),
typeof(int),
typeof(EqualGridPanel),
new PropertyMetadata(1, OnLayoutPropertyChanged));
protected override Size ArrangeOverride(Size finalSize)
{
if (Rows <= 0 || Columns <= 0)
private static void OnLayoutPropertyChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
return new Size(0, 0);
if (d is EqualGridPanel panel)
{
panel.InvalidateMeasure();
panel.InvalidateArrange();
}
}
double cellWidth = finalSize.Width / Columns;
double cellHeight = finalSize.Height / Rows;
for (int i = 0; i < Children.Count; i++)
protected override Size MeasureOverride(Size availableSize)
{
int row = i / Columns;
int column = i % Columns;
if (Rows <= 0 || Columns <= 0)
{
return new Size(0, 0);
}
double x = column * cellWidth;
double y = row * cellHeight;
double cellWidth = availableSize.Width / Columns;
double cellHeight = availableSize.Height / Rows;
Rect rect = new Rect(x, y, cellWidth, cellHeight);
Children[i].Arrange(rect);
foreach (UIElement child in Children)
{
child.Measure(new Size(cellWidth, cellHeight));
}
return availableSize;
}
return finalSize;
protected override Size ArrangeOverride(Size finalSize)
{
if (Rows <= 0 || Columns <= 0)
{
return new Size(0, 0);
}
double cellWidth = finalSize.Width / Columns;
double cellHeight = finalSize.Height / Rows;
for (int i = 0; i < Children.Count; i++)
{
int row = i / Columns;
int column = i % Columns;
double x = column * cellWidth;
double y = row * cellHeight;
Rect rect = new Rect(x, y, cellWidth, cellHeight);
Children[i].Arrange(rect);
}
return finalSize;
}
}
}