WARNING: THIS SITE IS A MIRROR OF GITHUB.COM / IT CANNOT LOGIN OR REGISTER ACCOUNTS / THE CONTENTS ARE PROVIDED AS-IS / THIS SITE ASSUMES NO RESPONSIBILITY FOR ANY DISPLAYED CONTENT OR LINKS / IF YOU FOUND SOMETHING MAY NOT GOOD FOR EVERYONE, CONTACT ADMIN AT ilovescratch@foxmail.com
Skip to content

Commit b0f2524

Browse files
authored
Merge pull request #201 from reactivemarbles/AddNewControlsToAvaloniaUI
Add custom UI controls to CrissCross.Avalonia.UI
2 parents a6b5962 + 67c1774 commit b0f2524

File tree

14 files changed

+787
-0
lines changed

14 files changed

+787
-0
lines changed
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia;
6+
7+
namespace CrissCross.Avalonia.UI.Controls;
8+
9+
/// <summary>
10+
/// A Fluent Window with integrated navigation support.
11+
/// </summary>
12+
public class FluentNavigationWindow : FluentWindow
13+
{
14+
/// <summary>
15+
/// Property for <see cref="NavigationView"/>.
16+
/// </summary>
17+
public static readonly StyledProperty<NavigationView?> NavigationViewProperty =
18+
AvaloniaProperty.Register<FluentNavigationWindow, NavigationView?>(
19+
nameof(NavigationView), null);
20+
21+
/// <summary>
22+
/// Gets or sets the navigation view for this window.
23+
/// </summary>
24+
public NavigationView? NavigationView
25+
{
26+
get => GetValue(NavigationViewProperty);
27+
set => SetValue(NavigationViewProperty, value);
28+
}
29+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia;
6+
using Avalonia.Controls;
7+
using Avalonia.Controls.Primitives;
8+
9+
namespace CrissCross.Avalonia.UI.Controls;
10+
11+
/// <summary>
12+
/// Represents a collection of gauge controls for data visualization.
13+
/// </summary>
14+
public class Gauges : TemplatedControl
15+
{
16+
/// <summary>
17+
/// Property for <see cref="Value"/>.
18+
/// </summary>
19+
public static readonly StyledProperty<double> ValueProperty =
20+
AvaloniaProperty.Register<Gauges, double>(nameof(Value), 0.0);
21+
22+
/// <summary>
23+
/// Gets or sets the gauge value.
24+
/// </summary>
25+
public double Value
26+
{
27+
get => GetValue(ValueProperty);
28+
set => SetValue(ValueProperty, value);
29+
}
30+
}
Lines changed: 44 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,44 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia;
6+
using Avalonia.Media;
7+
8+
namespace CrissCross.Avalonia.UI.Controls;
9+
10+
/// <summary>
11+
/// Represents an image with additional properties.
12+
/// </summary>
13+
public class GifImage : global::Avalonia.Controls.Image
14+
{
15+
/// <summary>
16+
/// Property for <see cref="CornerRadius"/>.
17+
/// </summary>
18+
public static readonly StyledProperty<CornerRadius> CornerRadiusProperty = AvaloniaProperty.Register<GifImage, CornerRadius>(
19+
nameof(CornerRadius), new CornerRadius(0));
20+
21+
/// <summary>
22+
/// Property for <see cref="StretchDirection"/>.
23+
/// </summary>
24+
public static readonly StyledProperty<StretchDirection> StretchDirectionProperty = AvaloniaProperty.Register<GifImage, StretchDirection>(
25+
nameof(StretchDirection), StretchDirection.Both);
26+
27+
/// <summary>
28+
/// Gets or sets the CornerRadius.
29+
/// </summary>
30+
public CornerRadius CornerRadius
31+
{
32+
get => GetValue(CornerRadiusProperty);
33+
set => SetValue(CornerRadiusProperty, value);
34+
}
35+
36+
/// <summary>
37+
/// Gets or sets the stretch direction.
38+
/// </summary>
39+
public StretchDirection StretchDirection
40+
{
41+
get => GetValue(StretchDirectionProperty);
42+
set => SetValue(StretchDirectionProperty, value);
43+
}
44+
}
Lines changed: 73 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,73 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia;
6+
7+
namespace CrissCross.Avalonia.UI.Controls;
8+
9+
/// <summary>
10+
/// InfoBadge, a control that displays a small amount of information, typically a number or a small piece of text, in a compact way.
11+
/// </summary>
12+
public class InfoBadge : global::Avalonia.Controls.Control
13+
{
14+
/// <summary>
15+
/// Property for <see cref="Severity"/>.
16+
/// </summary>
17+
public static readonly StyledProperty<InfoBadgeSeverity> SeverityProperty = AvaloniaProperty.Register<InfoBadge, InfoBadgeSeverity>(
18+
nameof(Severity), InfoBadgeSeverity.Informational);
19+
20+
/// <summary>
21+
/// Property for <see cref="Value"/>.
22+
/// </summary>
23+
public static readonly StyledProperty<string> ValueProperty = AvaloniaProperty.Register<InfoBadge, string>(
24+
nameof(Value), string.Empty);
25+
26+
/// <summary>
27+
/// Property for <see cref="CornerRadius"/>.
28+
/// </summary>
29+
public static readonly StyledProperty<CornerRadius> CornerRadiusProperty = AvaloniaProperty.Register<InfoBadge, CornerRadius>(
30+
nameof(CornerRadius), new CornerRadius(8));
31+
32+
/// <summary>
33+
/// Property for <see cref="Icon"/>.
34+
/// </summary>
35+
public static readonly StyledProperty<object> IconProperty = AvaloniaProperty.Register<InfoBadge, object>(
36+
nameof(Icon), null);
37+
38+
/// <summary>
39+
/// Gets or sets the severity.
40+
/// </summary>
41+
public InfoBadgeSeverity Severity
42+
{
43+
get => GetValue(SeverityProperty);
44+
set => SetValue(SeverityProperty, value);
45+
}
46+
47+
/// <summary>
48+
/// Gets or sets the value.
49+
/// </summary>
50+
public string Value
51+
{
52+
get => GetValue(ValueProperty);
53+
set => SetValue(ValueProperty, value);
54+
}
55+
56+
/// <summary>
57+
/// Gets or sets the corner radius.
58+
/// </summary>
59+
public CornerRadius CornerRadius
60+
{
61+
get => GetValue(CornerRadiusProperty);
62+
set => SetValue(CornerRadiusProperty, value);
63+
}
64+
65+
/// <summary>
66+
/// Gets or sets the icon.
67+
/// </summary>
68+
public object? Icon
69+
{
70+
get => GetValue(IconProperty);
71+
set => SetValue(IconProperty, value);
72+
}
73+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia;
6+
using Avalonia.Controls;
7+
using Avalonia.Controls.Primitives;
8+
9+
namespace CrissCross.Avalonia.UI.Controls;
10+
11+
/// <summary>
12+
/// Represents a loading screen overlay control.
13+
/// </summary>
14+
public class LoadingScreen : TemplatedControl
15+
{
16+
/// <summary>
17+
/// Property for <see cref="IsLoading"/>.
18+
/// </summary>
19+
public static readonly StyledProperty<bool> IsLoadingProperty =
20+
AvaloniaProperty.Register<LoadingScreen, bool>(nameof(IsLoading), false);
21+
22+
/// <summary>
23+
/// Gets or sets a value indicating whether the loading screen is visible.
24+
/// </summary>
25+
public bool IsLoading
26+
{
27+
get => GetValue(IsLoadingProperty);
28+
set => SetValue(IsLoadingProperty, value);
29+
}
30+
}
Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia.Controls;
6+
7+
namespace CrissCross.Avalonia.UI.Controls;
8+
9+
/// <summary>
10+
/// A modern styled Window.
11+
/// </summary>
12+
public class ModernWindow : Window
13+
{
14+
/// <summary>
15+
/// Initializes a new instance of the <see cref="ModernWindow"/> class.
16+
/// </summary>
17+
public ModernWindow()
18+
{
19+
// Configure window for modern appearance
20+
SystemDecorations = SystemDecorations.BorderOnly;
21+
TransparencyLevelHint = new[] { WindowTransparencyLevel.AcrylicBlur };
22+
}
23+
}
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia.Controls;
6+
using Avalonia.Layout;
7+
8+
namespace CrissCross.Avalonia.UI.Controls;
9+
10+
/// <summary>
11+
/// Represents a numeric keypad control for number input.
12+
/// </summary>
13+
public class NumberPad : Grid
14+
{
15+
/// <summary>
16+
/// Initializes a new instance of the <see cref="NumberPad"/> class.
17+
/// </summary>
18+
public NumberPad()
19+
{
20+
// 4x3 grid for standard number pad layout
21+
RowDefinitions = new RowDefinitions("*,*,*,*");
22+
ColumnDefinitions = new ColumnDefinitions("*,*,*");
23+
}
24+
}
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia;
6+
using Avalonia.Controls;
7+
8+
namespace CrissCross.Avalonia.UI.Controls;
9+
10+
/// <summary>
11+
/// Represents a button with numeric increment/decrement functionality.
12+
/// </summary>
13+
public class NumericPushButton : Button
14+
{
15+
/// <summary>
16+
/// Property for <see cref="NumericValue"/>.
17+
/// </summary>
18+
public static readonly StyledProperty<double> NumericValueProperty =
19+
AvaloniaProperty.Register<NumericPushButton, double>(nameof(NumericValue), 0.0);
20+
21+
/// <summary>
22+
/// Gets or sets the numeric value.
23+
/// </summary>
24+
public double NumericValue
25+
{
26+
get => GetValue(NumericValueProperty);
27+
set => SetValue(NumericValueProperty, value);
28+
}
29+
}
Lines changed: 103 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,103 @@
1+
// Copyright (c) 2019-2025 ReactiveUI Association Incorporated. All rights reserved.
2+
// ReactiveUI Association Incorporated licenses this file to you under the MIT license.
3+
// See the LICENSE file in the project root for full license information.
4+
5+
using Avalonia;
6+
7+
namespace CrissCross.Avalonia.UI.Controls;
8+
9+
/// <summary>
10+
/// PersonPicture.
11+
/// </summary>
12+
public class PersonPicture : global::Avalonia.Controls.Control
13+
{
14+
/// <summary>
15+
/// Property for <see cref="DisplayName"/>.
16+
/// </summary>
17+
public static readonly StyledProperty<string> DisplayNameProperty = AvaloniaProperty.Register<PersonPicture, string>(
18+
nameof(DisplayName), string.Empty);
19+
20+
/// <summary>
21+
/// Property for <see cref="Initials"/>.
22+
/// </summary>
23+
public static readonly StyledProperty<string> InitialsProperty = AvaloniaProperty.Register<PersonPicture, string>(
24+
nameof(Initials), string.Empty);
25+
26+
/// <summary>
27+
/// Property for <see cref="IsGroup"/>.
28+
/// </summary>
29+
public static readonly StyledProperty<bool> IsGroupProperty = AvaloniaProperty.Register<PersonPicture, bool>(
30+
nameof(IsGroup), false);
31+
32+
/// <summary>
33+
/// Property for <see cref="BadgeNumber"/>.
34+
/// </summary>
35+
public static readonly StyledProperty<int> BadgeNumberProperty = AvaloniaProperty.Register<PersonPicture, int>(
36+
nameof(BadgeNumber), 0);
37+
38+
/// <summary>
39+
/// Property for <see cref="BadgeGlyph"/>.
40+
/// </summary>
41+
public static readonly StyledProperty<string> BadgeGlyphProperty = AvaloniaProperty.Register<PersonPicture, string>(
42+
nameof(BadgeGlyph), string.Empty);
43+
44+
/// <summary>
45+
/// Property for <see cref="BadgeText"/>.
46+
/// </summary>
47+
public static readonly StyledProperty<string> BadgeTextProperty = AvaloniaProperty.Register<PersonPicture, string>(
48+
nameof(BadgeText), string.Empty);
49+
50+
/// <summary>
51+
/// Gets or sets the display name.
52+
/// </summary>
53+
public string DisplayName
54+
{
55+
get => GetValue(DisplayNameProperty);
56+
set => SetValue(DisplayNameProperty, value);
57+
}
58+
59+
/// <summary>
60+
/// Gets or sets the initials.
61+
/// </summary>
62+
public string Initials
63+
{
64+
get => GetValue(InitialsProperty);
65+
set => SetValue(InitialsProperty, value);
66+
}
67+
68+
/// <summary>
69+
/// Gets or sets a value indicating whether this is a group.
70+
/// </summary>
71+
public bool IsGroup
72+
{
73+
get => GetValue(IsGroupProperty);
74+
set => SetValue(IsGroupProperty, value);
75+
}
76+
77+
/// <summary>
78+
/// Gets or sets the badge number.
79+
/// </summary>
80+
public int BadgeNumber
81+
{
82+
get => GetValue(BadgeNumberProperty);
83+
set => SetValue(BadgeNumberProperty, value);
84+
}
85+
86+
/// <summary>
87+
/// Gets or sets the badge glyph.
88+
/// </summary>
89+
public string BadgeGlyph
90+
{
91+
get => GetValue(BadgeGlyphProperty);
92+
set => SetValue(BadgeGlyphProperty, value);
93+
}
94+
95+
/// <summary>
96+
/// Gets or sets the badge text.
97+
/// </summary>
98+
public string BadgeText
99+
{
100+
get => GetValue(BadgeTextProperty);
101+
set => SetValue(BadgeTextProperty, value);
102+
}
103+
}

0 commit comments

Comments
 (0)