File scoped namespaces

This commit is contained in:
ClemensFischer 2026-04-13 17:14:49 +02:00
parent c14377f976
commit 65aba44af6
152 changed files with 11962 additions and 12115 deletions

View file

@ -15,63 +15,62 @@ using Microsoft.UI.Xaml.Media;
using Microsoft.UI.Xaml.Shapes;
#endif
namespace MapControl
namespace MapControl;
[ContentProperty(Name = "Child")]
public partial class PushpinBorder : UserControl
{
[ContentProperty(Name = "Child")]
public partial class PushpinBorder : UserControl
public static readonly DependencyProperty ArrowSizeProperty =
DependencyPropertyHelper.Register<PushpinBorder, Size>(nameof(ArrowSize), new Size(10d, 20d),
(border, oldValue, newValue) => border.SetBorderMargin());
public static readonly DependencyProperty BorderWidthProperty =
DependencyPropertyHelper.Register<PushpinBorder, double>(nameof(BorderWidth), 0d,
(border, oldValue, newValue) => border.SetBorderMargin());
private readonly Border border = new Border();
public PushpinBorder()
{
public static readonly DependencyProperty ArrowSizeProperty =
DependencyPropertyHelper.Register<PushpinBorder, Size>(nameof(ArrowSize), new Size(10d, 20d),
(border, oldValue, newValue) => border.SetBorderMargin());
public static readonly DependencyProperty BorderWidthProperty =
DependencyPropertyHelper.Register<PushpinBorder, double>(nameof(BorderWidth), 0d,
(border, oldValue, newValue) => border.SetBorderMargin());
private readonly Border border = new Border();
public PushpinBorder()
var path = new Path
{
var path = new Path
{
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Stretch = Stretch.None
};
HorizontalAlignment = HorizontalAlignment.Stretch,
VerticalAlignment = VerticalAlignment.Stretch,
Stretch = Stretch.None
};
path.SetBinding(Shape.FillProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(Background)) });
path.SetBinding(Shape.FillProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(Background)) });
path.SetBinding(Shape.StrokeProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(BorderBrush)) });
path.SetBinding(Shape.StrokeProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(BorderBrush)) });
path.SetBinding(Shape.StrokeThicknessProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(BorderWidth)) });
path.SetBinding(Shape.StrokeThicknessProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(BorderWidth)) });
border.SetBinding(PaddingProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(Padding)) });
border.SetBinding(PaddingProperty,
new Binding { Source = this, Path = new PropertyPath(nameof(Padding)) });
SetBorderMargin();
SetBorderMargin();
var grid = new Grid();
grid.Children.Add(path);
grid.Children.Add(border);
var grid = new Grid();
grid.Children.Add(path);
grid.Children.Add(border);
Content = grid;
Content = grid;
SizeChanged += (_, _) => path.Data = BuildGeometry();
}
SizeChanged += (_, _) => path.Data = BuildGeometry();
}
public UIElement Child
{
get => border.Child;
set => border.Child = value;
}
public UIElement Child
{
get => border.Child;
set => border.Child = value;
}
private void SetBorderMargin()
{
border.Margin = new Thickness(
BorderWidth, BorderWidth, BorderWidth, BorderWidth + ArrowSize.Height);
}
private void SetBorderMargin()
{
border.Margin = new Thickness(
BorderWidth, BorderWidth, BorderWidth, BorderWidth + ArrowSize.Height);
}
}