All Projects → jp2masa → Avalonia.PropertyGenerator

jp2masa / Avalonia.PropertyGenerator

Licence: MIT license
Avalonia.PropertyGenerator generates the appropriate CLR members for Avalonia property definitions.

Programming Languages

C#
18002 projects

Projects that are alternatives of or similar to Avalonia.PropertyGenerator

Scriptcs
Write C# apps with a text editor, nuget and the power of Roslyn!
Stars: ✭ 2,343 (+11615%)
Mutual labels:  roslyn
get-source
Fetch source-mapped sources. Peek by file, line, column. Node & browsers. Sync & async.
Stars: ✭ 26 (+30%)
Mutual labels:  source
slm-code-generation
TensorFlow code for the neural network presented in the paper: "Structural Language Models of Code" (ICML'2020)
Stars: ✭ 75 (+275%)
Mutual labels:  source
Roslyn Security Guard
Roslyn analyzers that aim to help security audit on .NET applications.
Stars: ✭ 214 (+970%)
Mutual labels:  roslyn
Platform Compat
Roslyn analyzer that finds usages of APIs that will throw PlatformNotSupportedException on certain platforms.
Stars: ✭ 250 (+1150%)
Mutual labels:  roslyn
DesktopNotifications
A cross-platform C# library for native desktop "toast" notifications.
Stars: ✭ 97 (+385%)
Mutual labels:  avalonia
Bridge
♠️ C# to JavaScript compiler. Write modern mobile and web apps in C#. Run anywhere with Bridge.NET.
Stars: ✭ 2,216 (+10980%)
Mutual labels:  roslyn
DialogHost.Avalonia
AvaloniaUI control that provides a simple way to display a dialog with information or prompt the user when information is needed
Stars: ✭ 92 (+360%)
Mutual labels:  avalonia
opensource
Collection of Open Source packages by Otherwise
Stars: ✭ 21 (+5%)
Mutual labels:  source
HexTags
Customize tags & chat colors!
Stars: ✭ 53 (+165%)
Mutual labels:  source
Retyped
Access 3600+ libraries from C# and let Bridge.NET compile your project into JavaScript.
Stars: ✭ 216 (+980%)
Mutual labels:  roslyn
Roslyn
The Roslyn .NET compiler provides C# and Visual Basic languages with rich code analysis APIs.
Stars: ✭ 15,296 (+76380%)
Mutual labels:  roslyn
SaveVolley
Save volley from anything, By Agera to save. Thus, derived the AgeraVolley . (。>﹏<。)
Stars: ✭ 29 (+45%)
Mutual labels:  source
Seriloganalyzer
Roslyn-based analysis for code using the Serilog logging library. Checks for common mistakes and usage problems.
Stars: ✭ 214 (+970%)
Mutual labels:  roslyn
has-value
Returns true if a value exists, false if empty. Works with deeply nested values using object paths.
Stars: ✭ 27 (+35%)
Mutual labels:  property
Pluginframework
Everything is a Plugin in .NET
Stars: ✭ 197 (+885%)
Mutual labels:  roslyn
website
Website source for Jikan.moe
Stars: ✭ 28 (+40%)
Mutual labels:  source
Analyzers
C# code analyzers
Stars: ✭ 18 (-10%)
Mutual labels:  roslyn
IconPacks.Browser
The Browser for all available Icon packages from MahApps.Metro.IconPacks
Stars: ✭ 74 (+270%)
Mutual labels:  avalonia
Norns
dotnet core aop static weaving on roslyn
Stars: ✭ 23 (+15%)
Mutual labels:  roslyn

Build status NuGet MyGet

Avalonia.PropertyGenerator

Avalonia.PropertyGenerator generates the appropriate CLR members for Avalonia property definitions.

Usage

  1. Add reference to jp2masa.Avalonia.PropertyGenerator.CSharp package:
<PackageReference Include="jp2masa.Avalonia.PropertyGenerator.CSharp" Version="0.10.0-beta2" PrivateAssets="All" />
  1. Declare Avalonia properties as usual, except the CLR members, which are now automatically generated!

Example

Source

using Avalonia.Controls;
using Avalonia.Controls.Primitives;

namespace Avalonia.PropertyGenerator.CSharp.Demo
{
    internal sealed partial class DemoControl : TemplatedControl
    {
        public static readonly StyledProperty<double> NumberProperty =
            AvaloniaProperty.Register<DemoControl, double>(nameof(Number));

        [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);

        public static readonly AttachedProperty<bool> BoolProperty =
            AvaloniaProperty.RegisterAttached<DemoControl, Control, bool>("Bool");

        public DemoControl()
        {
            m_text = "Hello World!";
        }
    }
}

Generated code

namespace Avalonia.PropertyGenerator.CSharp.Demo
{
    partial class DemoControl
    {
        public double Number
        {
            get => GetValue(NumberProperty);
            set => SetValue(NumberProperty, value);
        }

        internal string? m_text;

        public string? Text
        {
            get => m_text;
            set => SetAndRaise(TextProperty, ref m_text, value);
        }

        public static bool GetBool(Avalonia.AvaloniaObject obj) => obj.GetValue(BoolProperty);

        public static void SetBool(Avalonia.AvaloniaObject obj, bool value) => obj.SetValue(BoolProperty, value);
    }
}

TODO

  • Readonly direct properties
  • Generate XML documentation
Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].