jp2masa - jp2masa.Avalonia.PropertyGenerator.CSharp 0.10.0-beta2
Avalonia.PropertyGenerator generates the appropriate CLR members for Avalonia property definitions.
PM> Install-Package jp2masa.Avalonia.PropertyGenerator.CSharp -Version 0.10.0-beta2 -Source https://www.myget.org/F/jp2masa/api/v3/index.json
> nuget.exe install jp2masa.Avalonia.PropertyGenerator.CSharp -Version 0.10.0-beta2 -Source https://www.myget.org/F/jp2masa/api/v3/index.json
> dotnet add package jp2masa.Avalonia.PropertyGenerator.CSharp --version 0.10.0-beta2 --source https://www.myget.org/F/jp2masa/api/v3/index.json
<PackageReference Include="jp2masa.Avalonia.PropertyGenerator.CSharp" Version="0.10.0-beta2" />
Copy to clipboard
source https://www.myget.org/F/jp2masa/api/v3/index.json
nuget jp2masa.Avalonia.PropertyGenerator.CSharp ~> 0.10.0-beta2
Copy to clipboard
> choco install jp2masa.Avalonia.PropertyGenerator.CSharp --version 0.10.0-beta2 --source https://www.myget.org/F/jp2masa/api/v2
Import-Module PowerShellGet
Register-PSRepository -Name "jp2masa" -SourceLocation "https://www.myget.org/F/jp2masa/api/v2"
Install-Module -Name "jp2masa.Avalonia.PropertyGenerator.CSharp" -RequiredVersion "0.10.0-beta2" -Repository "jp2masa" -AllowPreRelease
Copy to clipboard
Avalonia.PropertyGenerator
Avalonia.PropertyGenerator generates the appropriate CLR members for Avalonia property definitions.
Usage
- Add reference to
jp2masa.Avalonia.PropertyGenerator.CSharppackage:
<PackageReference Include="jp2masa.Avalonia.PropertyGenerator.CSharp" Version="0.10.0-beta2" PrivateAssets="All" />
- Declare Avalonia properties as usual, except the CLR members, which are now automatically generated!
Example
Source
using System.Globalization;
using Avalonia.Controls;
using Avalonia.Controls.Primitives;
namespace Avalonia.PropertyGenerator.CSharp.Demo
{
internal sealed partial class DemoControl : TemplatedControl
{
public static readonly StyledProperty<decimal> NumberProperty =
AvaloniaProperty.Register<DemoControl, decimal>(nameof(Number));
public static readonly StyledProperty<double?> NullableNumberProperty =
AvaloniaProperty.Register<DemoControl, double?>(nameof(NullableNumber));
[BackingField(Name = "m_text", Accessibility = BackingFieldAccessibility.Internal)]
public static readonly DirectProperty<DemoControl, string?> TextProperty =
AvaloniaProperty.RegisterDirect<DemoControl, string?>(nameof(Text), o => o.Text, (o, v) => o.Text = v);
[Readonly]
public static readonly DirectProperty<DemoControl, string> ReadonlyTextProperty =
AvaloniaProperty.RegisterDirect<DemoControl, string>(nameof(ReadonlyText), o => o.ReadonlyText);
public static readonly AttachedProperty<bool> BoolProperty =
AvaloniaProperty.RegisterAttached<DemoControl, Control, bool>("Bool");
public static readonly StyledProperty<string> ExistingStyledProperty =
AvaloniaProperty.Register<DemoControl, string>(nameof(ExistingStyled));
public string ExistingStyled => GetValue(ExistingStyledProperty);
static DemoControl()
{
NumberProperty.Changed.AddClassHandler<DemoControl, decimal>(
(sender, e) =>
{
var str = e.NewValue.Value.ToString(CultureInfo.CurrentCulture);
sender.SetAndRaise(ReadonlyTextProperty, ref sender._readonlyText, str);
sender.SetValue(ExistingStyledProperty, str);
}
);
}
public DemoControl()
{
m_text = "Hello World!";
_readonlyText = "0";
SetValue(ExistingStyledProperty, "0");
}
}
}
Generated code
(To make the code more readable, generated attributes such as GeneratedCode and ExcludeFromCodeCoverage were removed.)
namespace Avalonia.PropertyGenerator.CSharp.Demo
{
partial class DemoControl
{
public decimal Number
{
get => GetValue(NumberProperty);
set => SetValue(NumberProperty, value);
}
public double? NullableNumber
{
get => GetValue(NullableNumberProperty);
set => SetValue(NullableNumberProperty, value);
}
internal string? m_text;
public string? Text
{
get => m_text;
set => SetAndRaise(TextProperty, ref m_text, value);
}
private string _readonlyText;
public string ReadonlyText => _readonlyText;
public static bool GetBool(global::Avalonia.AvaloniaObject obj) =>
(obj ?? throw new global::System.ArgumentNullException(nameof(obj))).GetValue(BoolProperty);
public static void SetBool(global::Avalonia.AvaloniaObject obj, bool value) =>
(obj ?? throw new global::System.ArgumentNullException(nameof(obj))).SetValue(BoolProperty, value);
}
}
Ownersjp2masa |
Authorsjp2masa |
Project URLhttp://github.com/jp2masa/Avalonia.PropertyGenerator |
LicenseUnknown |
Tagsavalonia property styled direct attached source generator dotnet core csharp |
Info3002 total downloads |
| 64 downloads for version 0.10.0-beta2 |
| Download (9.57 KB) |
| Found on the current feed only |
Package history
| Version | Size | Last updated | Downloads | Mirrored? | |||
|---|---|---|---|---|---|---|---|
|
|
0.11.0-build.47+fc78db0 | 14.25 KB | Fri, 08 Aug 2025 01:13:30 GMT | 59 |
|
||
|
|
0.11.0-build.45+8c6673f | 14.26 KB | Fri, 08 Aug 2025 00:54:09 GMT | 69 |
|
||
|
|
0.11.0-build.44+25025a1 | 14.25 KB | Fri, 08 Aug 2025 00:50:23 GMT | 50 |
|
||
|
|
0.11.0-build.43+ebff3ff | 14.25 KB | Fri, 08 Aug 2025 00:27:55 GMT | 68 |
|
||
|
|
0.11.0-build.42+1eace16 | 14.25 KB | Fri, 08 Aug 2025 00:15:22 GMT | 53 |
|
||
|
|
0.11.0-build.41+dd8aa00 | 13.86 KB | Thu, 07 Aug 2025 03:56:00 GMT | 60 |
|
||
|
|
0.11.0-build.40+671899b | 13.8 KB | Thu, 07 Aug 2025 01:40:22 GMT | 64 |
|
||
|
|
0.11.0-build.39+c6cb274 | 13.84 KB | Wed, 06 Aug 2025 20:09:09 GMT | 71 |
|
||
|
|
0.11.0-build.37+acb1be3 | 13.77 KB | Tue, 05 Aug 2025 10:39:12 GMT | 71 |
|
||
|
|
0.11.0-build.35+d352c76 | 13.77 KB | Tue, 05 Aug 2025 10:10:46 GMT | 74 |
|
||
|
|
0.11.0-beta2 | 14.22 KB | Fri, 08 Aug 2025 00:58:51 GMT | 60 |
|
||
|
|
0.11.0-beta | 13.73 KB | Tue, 05 Aug 2025 10:44:21 GMT | 58 |
|
||
|
|
0.10.0-build.34+c2968b2 | 13.77 KB | Tue, 05 Aug 2025 10:03:24 GMT | 63 |
|
||
|
|
0.10.0-build.33+5d981ad | 13.8 KB | Tue, 05 Aug 2025 09:16:03 GMT | 76 |
|
||
|
|
0.10.0-build.32+c6e1c79 | 13.26 KB | Tue, 05 Aug 2025 09:12:10 GMT | 60 |
|
||
|
|
0.10.0-build.31+6c59b3a | 13.22 KB | Tue, 05 Aug 2025 09:07:51 GMT | 59 |
|
||
|
|
0.10.0-build.28+8e73dae | 13.14 KB | Sat, 01 Jul 2023 19:34:19 GMT | 62 |
|
||
|
|
0.10.0-build.27+cbd16d4 | 13.15 KB | Sat, 01 Jul 2023 19:30:47 GMT | 61 |
|
||
|
|
0.10.0-build.25+a192ca3 | 13.14 KB | Sun, 14 May 2023 02:56:07 GMT | 78 |
|
||
|
|
0.10.0-build.24+744d22b | 13.14 KB | Sun, 14 May 2023 02:53:22 GMT | 77 |
|
||
|
|
0.10.0-build.22+ef7ef00 | 13.02 KB | Sat, 04 Feb 2023 19:03:05 GMT | 73 |
|
||
|
|
0.10.0-build.21+b5e9ae2 | 12.96 KB | Wed, 10 Aug 2022 01:31:06 GMT | 62 |
|
||
|
|
0.10.0-build.19+eb1b5da | 13.01 KB | Fri, 22 Jul 2022 01:30:18 GMT | 77 |
|
||
|
|
0.10.0-build.16+2858bb9 | 12.88 KB | Tue, 03 Aug 2021 19:06:03 GMT | 67 |
|
||
|
|
0.10.0-build.15+dabec27 | 12.88 KB | Tue, 03 Aug 2021 18:57:24 GMT | 86 |
|
||
|
|
0.10.0-build.14+95b9c28 | 11.36 KB | Tue, 03 Aug 2021 17:25:55 GMT | 89 |
|
||
|
|
0.10.0-build.13+1e4a09c | 11.24 KB | Sun, 18 Jul 2021 23:22:55 GMT | 82 |
|
||
|
|
0.10.0-build.12+d2d97e0 | 11.21 KB | Wed, 05 May 2021 22:07:25 GMT | 75 |
|
||
|
|
0.10.0-build.11+4b618fd | 11.21 KB | Mon, 08 Feb 2021 03:45:31 GMT | 76 |
|
||
|
|
0.10.0-build.10+15fb643 | 10.2 KB | Mon, 08 Feb 2021 02:19:13 GMT | 73 |
|
||
|
|
0.10.0-build.9+134dd0f | 9.58 KB | Thu, 28 Jan 2021 16:37:06 GMT | 74 |
|
||
|
|
0.10.0-build.7+75e1637 | 9.58 KB | Thu, 28 Jan 2021 16:26:46 GMT | 77 |
|
||
|
|
0.10.0-build.6+1e72d72 | 9.57 KB | Thu, 28 Jan 2021 15:50:58 GMT | 70 |
|
||
|
|
0.10.0-build.5+eecc17c | 9.57 KB | Thu, 28 Jan 2021 15:05:28 GMT | 69 |
|
||
|
|
0.10.0-build.4+f293814 | 9.57 KB | Thu, 28 Jan 2021 03:21:40 GMT | 71 |
|
||
|
|
0.10.0-build.2+9c790c6 | 9.57 KB | Thu, 28 Jan 2021 03:17:18 GMT | 78 |
|
||
|
|
0.10.0-build.1+d333c3d | 9.56 KB | Thu, 28 Jan 2021 02:53:24 GMT | 72 |
|
||
|
|
0.10.0-beta7 | 13.13 KB | Sat, 01 Jul 2023 19:37:20 GMT | 72 |
|
||
|
|
0.10.0-beta6 | 13.13 KB | Sun, 14 May 2023 02:59:02 GMT | 70 |
|
||
|
|
0.10.0-beta5 | 13.01 KB | Sat, 04 Feb 2023 19:16:37 GMT | 77 |
|
||
|
|
0.10.0-beta4 | 13 KB | Fri, 22 Jul 2022 01:33:00 GMT | 75 |
|
||
|
|
0.10.0-beta3 | 12.86 KB | Tue, 03 Aug 2021 19:08:11 GMT | 80 |
|
||
|
|
0.10.0-beta2 | 9.57 KB | Thu, 28 Jan 2021 16:31:07 GMT | 64 |
|