DependencyPropertyGenerator 0.15.0
See the version list below for details.
dotnet add package DependencyPropertyGenerator --version 0.15.0
NuGet\Install-Package DependencyPropertyGenerator -Version 0.15.0
<PackageReference Include="DependencyPropertyGenerator" Version="0.15.0"> <PrivateAssets>all</PrivateAssets> <IncludeAssets>runtime; build; native; contentfiles; analyzers</IncludeAssets> </PackageReference>
paket add DependencyPropertyGenerator --version 0.15.0
#r "nuget: DependencyPropertyGenerator, 0.15.0"
// Install DependencyPropertyGenerator as a Cake Addin #addin nuget:?package=DependencyPropertyGenerator&version=0.15.0 // Install DependencyPropertyGenerator as a Cake Tool #tool nuget:?package=DependencyPropertyGenerator&version=0.15.0
DependencyPropertyGenerator
Dependency property source generator for WPF/UWP/WinUI/Uno platforms.
Install
Install-Package DependencyPropertyGenerator // Generator
Install-Package DependencyPropertyGenerator.Core // Attributes
Usage
using DependencyPropertyGenerator;
using System.Windows;
using System.Windows.Controls;
#nullable enable
namespace H.Generators.IntegrationTests;
[DependencyProperty<bool>("IsSpinning", DefaultValue = true)]
public partial class MainWindow : Window
{
// Optional
static partial void OnIsSpinningChanged(MainWindow sender, bool oldValue, bool newValue)
{
}
}
[AttachedDependencyProperty<object, TreeView>("SelectedItem", BindsTwoWayByDefault = true)]
public static partial class TreeViewExtensions
{
// Optional
static partial void OnSelectedItemChanged(TreeView sender, object? oldValue, object? newValue)
{
}
}
will generate:
//HintName: MainWindow_DependencyProperties.generated.cs
#nullable enable
namespace H.Generators.IntegrationTests
{
public partial class MainWindow
{
public static readonly global::System.Windows.DependencyProperty IsSpinningProperty =
global::System.Windows.DependencyProperty.Register(
name: "IsSpinning",
propertyType: typeof(bool),
ownerType: typeof(MainWindow),
typeMetadata: new global::System.Windows.FrameworkPropertyMetadata(
true,
global::System.Windows.FrameworkPropertyMetadataOptions.None,
static (sender, args) => OnIsSpinningChanged((MainWindow)sender, (bool)args.OldValue, (bool)args.NewValue)));
public bool IsSpinning
{
get => (bool)GetValue(IsSpinningProperty);
set => SetValue(IsSpinningProperty, value);
}
static partial void OnIsSpinningChanged(MainWindow sender, bool oldValue, bool newValue);
}
}
//HintName: TreeViewExtensions_AttachedDependencyProperties.generated.cs
#nullable enable
namespace H.Generators.IntegrationTests
{
public static partial class TreeViewExtensions
{
public static readonly global::System.Windows.DependencyProperty SelectedItemProperty =
global::System.Windows.DependencyProperty.RegisterAttached(
name: "SelectedItem",
propertyType: typeof(object),
ownerType: typeof(TreeViewExtensions),
defaultMetadata: new global::System.Windows.FrameworkPropertyMetadata(
default(object),
global::System.Windows.FrameworkPropertyMetadataOptions.BindsTwoWayByDefault,
static (sender, args) => OnSelectedItemChanged((System.Windows.Controls.TreeView)sender, (object?)args.OldValue, (object?)args.NewValue)));
public static void SetSelectedItem(global::System.Windows.DependencyObject element, object? value)
{
element.SetValue(SelectedItemProperty, value);
}
[global::System.Windows.AttachedPropertyBrowsableForType(typeof(System.Windows.Controls.TreeView))]
public static object? GetSelectedItem(global::System.Windows.DependencyObject element)
{
return (object?)element.GetValue(SelectedItemProperty);
}
static partial void OnSelectedItemChanged(System.Windows.Controls.TreeView sender, object? oldValue, object? newValue);
}
}
Notes
To use generic attributes, you need to set up LangVersion
in your .csproj:
<LangVersion>preview</LangVersion>
There are also non-Generic attributes here.
Support
You can get answers to your questions in my discord support channel:
https://discord.gg/g8u2t9dKgE
Learn more about Target Frameworks and .NET Standard.
-
.NETStandard 2.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories (2)
Showing the top 2 popular GitHub repositories that depend on DependencyPropertyGenerator:
Repository | Stars |
---|---|
JasonWei512/EnergyStarX
🔋 Improve your Windows 11 device's battery life. A WinUI 3 GUI for https://github.com/imbushuo/EnergyStar.
|
|
HavenDV/H.NotifyIcon
TrayIcon for WPF/WinUI/Uno/MAUI
|
Version | Downloads | Last updated |
---|---|---|
1.5.0-beta.2 | 36 | 7/23/2024 |
1.5.0-beta.1 | 1,800 | 1/16/2024 |
1.4.0 | 2,582 | 1/5/2024 |
1.4.0-alpha.3 | 278 | 12/4/2023 |
1.4.0-alpha.2 | 71 | 12/1/2023 |
1.4.0-alpha.1 | 62 | 11/30/2023 |
1.3.3 | 3,540 | 11/7/2023 |
1.3.2 | 1,987 | 9/23/2023 |
1.3.1 | 433 | 9/9/2023 |
1.3.0 | 601 | 9/1/2023 |
1.2.12 | 184 | 8/29/2023 |
1.2.11 | 119 | 8/29/2023 |
1.2.8 | 154 | 8/28/2023 |
1.2.7 | 156 | 8/27/2023 |
1.2.6 | 135 | 8/25/2023 |
1.2.5 | 2,221 | 3/24/2023 |
1.2.4 | 736 | 3/14/2023 |
1.2.3 | 626 | 3/11/2023 |
1.2.2 | 284 | 3/10/2023 |
1.2.1 | 239 | 3/9/2023 |
1.2.0 | 224 | 3/8/2023 |
1.1.7 | 223 | 3/6/2023 |
1.1.5 | 381 | 2/14/2023 |
1.1.4 | 391 | 2/2/2023 |
1.1.3 | 263 | 2/2/2023 |
1.1.2 | 600 | 1/28/2023 |
1.1.1 | 314 | 1/27/2023 |
1.1.0 | 285 | 1/27/2023 |
1.0.7 | 319 | 1/18/2023 |
1.0.6 | 426 | 1/9/2023 |
1.0.5 | 266 | 1/9/2023 |
1.0.3 | 2,518 | 8/26/2022 |
1.0.2 | 369 | 8/26/2022 |
1.0.1 | 425 | 8/23/2022 |
1.0.0 | 585 | 8/22/2022 |
0.53.0 | 617 | 8/13/2022 |
0.52.2 | 737 | 7/29/2022 |
0.52.1 | 416 | 7/29/2022 |
0.52.0 | 407 | 7/28/2022 |
0.51.1 | 418 | 7/28/2022 |
0.51.0 | 407 | 7/27/2022 |
0.50.1 | 417 | 7/26/2022 |
0.50.0 | 421 | 7/26/2022 |
0.49.0 | 371 | 7/25/2022 |
0.48.1 | 424 | 7/19/2022 |
0.48.0 | 428 | 7/19/2022 |
0.47.0 | 389 | 7/18/2022 |
0.46.0 | 431 | 7/18/2022 |
0.45.0 | 425 | 7/18/2022 |
0.44.0 | 403 | 7/18/2022 |
0.43.1 | 453 | 7/18/2022 |
0.43.0 | 416 | 7/18/2022 |
0.42.0 | 480 | 7/17/2022 |
0.41.0 | 452 | 7/17/2022 |
0.40.0 | 428 | 7/17/2022 |
0.39.0 | 440 | 7/16/2022 |
0.38.0 | 404 | 7/16/2022 |
0.37.0 | 428 | 7/13/2022 |
0.36.3 | 531 | 7/9/2022 |
0.36.2 | 394 | 7/9/2022 |
0.36.1 | 425 | 7/9/2022 |
0.36.0 | 413 | 7/9/2022 |
0.35.1 | 404 | 7/8/2022 |
0.35.0 | 429 | 7/8/2022 |
0.34.3 | 454 | 7/1/2022 |
0.34.2 | 411 | 7/1/2022 |
0.34.1 | 437 | 6/30/2022 |
0.34.0 | 382 | 6/30/2022 |
0.33.0 | 435 | 6/29/2022 |
0.32.1 | 466 | 6/24/2022 |
0.32.0 | 422 | 6/24/2022 |
0.31.0 | 437 | 6/24/2022 |
0.29.0 | 424 | 6/24/2022 |
0.28.1 | 420 | 6/24/2022 |
0.28.0 | 432 | 6/23/2022 |
0.27.5 | 461 | 6/23/2022 |
0.27.4 | 441 | 6/23/2022 |
0.27.3 | 434 | 6/23/2022 |
0.27.2 | 415 | 6/23/2022 |
0.27.1 | 423 | 6/23/2022 |
0.27.0 | 419 | 6/23/2022 |
0.26.1 | 404 | 6/23/2022 |
0.26.0 | 429 | 6/23/2022 |
0.25.0 | 436 | 6/22/2022 |
0.24.0 | 429 | 6/22/2022 |
0.23.0 | 445 | 6/22/2022 |
0.22.0 | 394 | 6/22/2022 |
0.21.1 | 405 | 6/22/2022 |
0.21.0 | 399 | 6/22/2022 |
0.20.0 | 397 | 6/22/2022 |
0.19.1 | 429 | 6/21/2022 |
0.19.0 | 430 | 6/21/2022 |
0.18.0 | 405 | 6/21/2022 |
0.16.5 | 416 | 6/20/2022 |
0.16.4 | 399 | 6/20/2022 |
0.16.2 | 383 | 6/20/2022 |
0.16.1 | 397 | 6/20/2022 |
0.16.0 | 417 | 6/20/2022 |
0.15.1 | 433 | 6/20/2022 |
0.15.0 | 432 | 6/20/2022 |
0.14.0 | 435 | 6/20/2022 |
0.12.0 | 437 | 6/20/2022 |
0.10.0 | 408 | 6/20/2022 |
0.9.0 | 402 | 6/20/2022 |
0.8.0 | 433 | 6/20/2022 |
0.7.3 | 429 | 6/19/2022 |
0.7.2 | 444 | 6/19/2022 |
0.7.1 | 409 | 6/19/2022 |
0.7.0 | 360 | 6/19/2022 |
0.6.0 | 406 | 6/19/2022 |
0.3.3 | 413 | 6/19/2022 |
0.3.2 | 437 | 6/19/2022 |
0.0.0-beta.269 | 30 | 7/23/2024 |
⭐ Last 10 features:
Added xml documentation support.
Added xml documentation for attributes.
Added support for all FrameworkPropertyMetadataOptions.
Added nullable annotations.
Added casted oldValue/newValue parameters to OnChanged method.
Added second generic type for AttachedDependencyProperty.BrowsableForType.
Added generic attributes support.
Added BindsTwoWayByDefault support.
Added Attached property BrowsableForType support.
Added default values support.
🐞 Last 10 bug fixes:
Fixed bugs in attribute properties search process.
Added missing AllowMultiple to attributes.
Fixed some Attached properties bugs.
Fixed unused generator reference.
Fixed versioning bug.
Added generate-build-number: false.
Fixed tests.
Fixed initial project settings.