ObservableHelpers 2.0.10
dotnet add package ObservableHelpers --version 2.0.10
NuGet\Install-Package ObservableHelpers -Version 2.0.10
<PackageReference Include="ObservableHelpers" Version="2.0.10" />
paket add ObservableHelpers --version 2.0.10
#r "nuget: ObservableHelpers, 2.0.10"
// Install ObservableHelpers as a Cake Addin #addin nuget:?package=ObservableHelpers&version=2.0.10 // Install ObservableHelpers as a Cake Tool #tool nuget:?package=ObservableHelpers&version=2.0.10
Observable Helpers
Observable helpers with source generators and UI-safe property implementations. Can be used for any MVVM software architectural applications.
NuGets
Name | Info |
---|---|
ObservableHelpers |
Installation
// Install release version
Install-Package ObservableHelpers
// Install pre-release version
Install-Package ObservableHelpers -pre
Supported frameworks
.NET Standard 2.0 and above - see https://github.com/dotnet/standard/blob/master/docs/versions.md for compatibility matrix
Get Started
All observable events are executed on thread that was used to create the object instance. To use in UI safe updates, create the object instances at the UI thread or manually configure the ISyncObject.SyncOperation to use UI thread.
Usage
ObservableObject Sample
using ObservableHelpers;
namespace YourNamespace
{
[ObservableObject]
public partial class Dinosaur
{
[ObservableProperty]
string? name;
[ObservableProperty(Access = Access.PublicWithPrivateSetter)]
string? family;
[ObservableProperty]
int height;
}
}
Will Generate
using ObservableHelpers;
namespace YourNamespace
{
public partial class Dinosaur
{
public string? Name
{
get => name;
set
{
if (!EqualityComparer<string?>.Default.Equals(name, value))
{
OnNameChanging(value);
OnPropertyChanging(nameof(Name));
name = value;
OnNameChanged(value);
OnPropertyChanged(nameof(Name));
}
}
}
public string? Family
{
get => family;
private set
{
if (!EqualityComparer<string?>.Default.Equals(family, value))
{
OnFamilyChanging(value);
OnPropertyChanging(nameof(Family));
family = value;
OnFamilyChanged(value);
OnPropertyChanged(nameof(Family));
}
}
}
public int Height
{
get => height;
set
{
if (!EqualityComparer<int>.Default.Equals(height, value))
{
OnHeightChanging(value);
OnPropertyChanging(nameof(Height));
height = value;
OnHeightChanged(value);
OnPropertyChanged(nameof(Height));
}
}
}
}
}
UI safe
using ObservableHelpers;
namespace YourNamespace
{
public class Program
{
private Dinosaur dinosaur;
public void UIThread()
{
dinosaur = new Dinosaur(); // Must be created on UI thread to synchronize events
dinosaur.SynchronizeChangedEvent = true;
}
public void BackgroundThread()
{
dinosaur.PropertyChanged += (s, e) =>
{
// Executes on UI thread if dinosaur.SynchronizeChangedEvent is true (default false)
}
dinosaur.SynchronizedPropertyChanged += (s, e) =>
{
// Executed on UI thread
}
dinosaur.UnsynchronizedPropertyChanged += (s, e) =>
{
// Executed on current thread
}
dinosaur.Name = "Megalosaurus";
}
}
}
Code & Inspiration from the following:
Want To Support This Project?
All I have ever asked is to be active by submitting bugs, features, and sending those pull requests down!.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
.NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
.NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
.NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
MonoAndroid | monoandroid was computed. |
MonoMac | monomac was computed. |
MonoTouch | monotouch was computed. |
Tizen | tizen40 was computed. tizen60 was computed. |
Xamarin.iOS | xamarinios was computed. |
Xamarin.Mac | xamarinmac was computed. |
Xamarin.TVOS | xamarintvos was computed. |
Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- LockerHelpers (>= 1.0.3)
- Microsoft.Bcl.AsyncInterfaces (>= 6.0.0)
- SynchronizationContextHelpers (>= 1.0.5)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Memory (>= 4.5.5)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
.NETStandard 2.1
- LockerHelpers (>= 1.0.3)
- SynchronizationContextHelpers (>= 1.0.5)
- System.ComponentModel.Annotations (>= 5.0.0)
- System.Runtime.CompilerServices.Unsafe (>= 6.0.0)
-
net6.0
- LockerHelpers (>= 1.0.3)
- SynchronizationContextHelpers (>= 1.0.5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.0.10 | 666 | 9/9/2022 |
2.0.9 | 610 | 9/8/2022 |
2.0.8 | 415 | 9/8/2022 |
2.0.7 | 447 | 9/8/2022 |
2.0.6 | 417 | 9/5/2022 |
2.0.6-prerelease.14 | 119 | 9/5/2022 |
2.0.6-prerelease.13 | 107 | 9/5/2022 |
2.0.6-prerelease.11 | 103 | 9/5/2022 |
2.0.6-prerelease.10 | 102 | 9/5/2022 |
2.0.6-prerelease.8 | 109 | 9/5/2022 |
2.0.6-prerelease.7 | 108 | 9/5/2022 |
2.0.6-prerelease.6 | 108 | 9/5/2022 |
2.0.6-prerelease.4 | 116 | 9/5/2022 |
2.0.6-prerelease | 153 | 9/5/2022 |
2.0.5 | 396 | 9/4/2022 |
2.0.3 | 420 | 9/4/2022 |
2.0.1 | 439 | 9/4/2022 |
1.6.2 | 486 | 4/23/2022 |
1.6.1 | 454 | 4/22/2022 |
1.6.0 | 486 | 4/22/2022 |
1.5.5 | 1,645 | 3/7/2022 |
1.5.4 | 444 | 3/7/2022 |
1.5.3 | 426 | 3/7/2022 |
1.5.2 | 451 | 3/5/2022 |
1.5.1 | 453 | 2/23/2022 |
1.5.0 | 1,180 | 2/22/2022 |
1.4.8 | 726 | 2/21/2022 |
1.4.7 | 437 | 2/19/2022 |
1.4.6 | 451 | 2/19/2022 |
1.4.5 | 693 | 1/9/2022 |
1.4.4 | 441 | 1/9/2022 |
1.4.3 | 1,003 | 1/4/2022 |
1.4.2 | 441 | 1/2/2022 |
1.4.1 | 313 | 1/1/2022 |
1.4.0 | 317 | 1/1/2022 |
1.3.6 | 407 | 1/1/2022 |
1.3.5 | 509 | 12/25/2021 |
1.3.4 | 451 | 12/13/2021 |
1.3.3 | 328 | 12/6/2021 |
1.3.2 | 397 | 11/16/2021 |
1.3.1 | 375 | 11/16/2021 |
1.3.0 | 353 | 11/14/2021 |
1.2.7 | 356 | 11/10/2021 |
1.2.6 | 412 | 11/8/2021 |
1.2.5 | 337 | 11/3/2021 |
1.2.4 | 369 | 11/2/2021 |
1.2.3 | 375 | 10/26/2021 |
1.2.2 | 412 | 10/25/2021 |
1.2.1 | 350 | 10/21/2021 |
1.2.0 | 326 | 10/21/2021 |
1.1.12 | 1,494 | 9/1/2021 |
1.1.11 | 339 | 9/1/2021 |
1.1.10 | 343 | 9/1/2021 |
1.1.9 | 347 | 9/1/2021 |
1.1.8 | 1,036 | 8/26/2021 |
1.1.7 | 353 | 8/26/2021 |
1.1.6 | 350 | 8/26/2021 |
1.1.5 | 344 | 8/26/2021 |
1.1.4 | 363 | 8/26/2021 |
1.1.3 | 507 | 8/25/2021 |
1.1.2 | 342 | 8/25/2021 |
1.1.1 | 336 | 8/25/2021 |
1.1.0 | 332 | 8/25/2021 |
1.0.92 | 977 | 8/18/2021 |
1.0.91 | 970 | 8/9/2021 |
1.0.90 | 644 | 8/4/2021 |
1.0.89 | 480 | 7/19/2021 |
1.0.88 | 349 | 7/19/2021 |
1.0.87 | 1,075 | 7/3/2021 |
1.0.86 | 498 | 7/2/2021 |
1.0.85 | 414 | 7/1/2021 |
1.0.84 | 534 | 6/30/2021 |
1.0.83 | 376 | 6/28/2021 |
1.0.82 | 366 | 6/28/2021 |
1.0.81 | 687 | 6/27/2021 |
1.0.80 | 474 | 6/27/2021 |
1.0.79 | 489 | 6/27/2021 |
1.0.78 | 375 | 6/16/2021 |
1.0.77 | 1,085 | 6/16/2021 |
1.0.76 | 619 | 6/15/2021 |
1.0.75 | 768 | 6/15/2021 |
1.0.74 | 409 | 6/15/2021 |
1.0.73 | 414 | 6/15/2021 |
1.0.72 | 425 | 6/15/2021 |
1.0.71 | 412 | 6/15/2021 |
1.0.70 | 629 | 6/15/2021 |
1.0.69 | 369 | 6/15/2021 |
1.0.68 | 507 | 6/15/2021 |
1.0.67 | 423 | 6/14/2021 |
1.0.66 | 422 | 6/14/2021 |
1.0.65 | 667 | 6/14/2021 |
1.0.64 | 527 | 6/13/2021 |
1.0.63 | 381 | 6/13/2021 |
1.0.62 | 386 | 6/13/2021 |
1.0.61 | 421 | 6/13/2021 |
1.0.60 | 499 | 6/13/2021 |
1.0.59 | 392 | 6/13/2021 |
1.0.58 | 714 | 6/13/2021 |
1.0.57 | 537 | 6/12/2021 |
1.0.56 | 669 | 6/12/2021 |
1.0.55 | 437 | 6/12/2021 |
1.0.54 | 1,199 | 6/10/2021 |
1.0.53 | 417 | 6/10/2021 |
1.0.52 | 448 | 6/10/2021 |
1.0.51 | 406 | 6/10/2021 |
1.0.49 | 408 | 6/10/2021 |
1.0.48 | 403 | 6/9/2021 |
1.0.47 | 346 | 6/9/2021 |
1.0.46 | 337 | 6/9/2021 |
1.0.45 | 338 | 6/9/2021 |
1.0.44 | 339 | 6/9/2021 |
1.0.43 | 1,516 | 6/8/2021 |
1.0.42 | 1,452 | 6/6/2021 |
1.0.41 | 480 | 6/6/2021 |
1.0.40 | 480 | 6/6/2021 |
1.0.39 | 492 | 6/6/2021 |
1.0.38 | 362 | 6/6/2021 |
1.0.37 | 508 | 6/6/2021 |
1.0.36 | 373 | 6/6/2021 |
1.0.35 | 351 | 6/6/2021 |
1.0.34 | 465 | 6/6/2021 |
1.0.33 | 372 | 6/6/2021 |
1.0.32 | 640 | 6/5/2021 |
1.0.31 | 795 | 6/5/2021 |
1.0.30 | 548 | 6/5/2021 |
1.0.29 | 488 | 6/5/2021 |
1.0.28 | 525 | 6/4/2021 |
1.0.27 | 594 | 6/4/2021 |
1.0.26 | 331 | 6/4/2021 |
1.0.25 | 369 | 6/4/2021 |
1.0.24 | 381 | 6/4/2021 |
1.0.23 | 517 | 6/3/2021 |
1.0.22 | 864 | 6/3/2021 |
1.0.21 | 366 | 6/3/2021 |
1.0.20 | 728 | 6/2/2021 |
1.0.19 | 698 | 6/2/2021 |
1.0.18 | 355 | 6/2/2021 |
1.0.17 | 357 | 6/2/2021 |
1.0.16 | 2,098 | 5/20/2021 |
1.0.15 | 349 | 5/19/2021 |
1.0.14 | 355 | 5/18/2021 |
1.0.13 | 334 | 5/18/2021 |
1.0.12 | 363 | 5/18/2021 |
1.0.11 | 348 | 5/17/2021 |
1.0.10 | 820 | 5/13/2021 |
1.0.9 | 488 | 5/13/2021 |
1.0.8 | 343 | 5/13/2021 |
1.0.7 | 670 | 5/11/2021 |
1.0.6 | 319 | 5/11/2021 |
1.0.5 | 324 | 5/11/2021 |
1.0.4 | 337 | 5/11/2021 |
1.0.3 | 491 | 5/8/2021 |
1.0.2 | 370 | 5/8/2021 |
1.0.1 | 355 | 5/8/2021 |
1.0.0 | 467 | 5/8/2021 |
* Fixed ArgumentNullException wrong parameter names