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 | 663 | 9/9/2022 |
2.0.9 | 609 | 9/8/2022 |
2.0.8 | 414 | 9/8/2022 |
2.0.7 | 446 | 9/8/2022 |
2.0.6 | 416 | 9/5/2022 |
2.0.6-prerelease.14 | 118 | 9/5/2022 |
2.0.6-prerelease.13 | 104 | 9/5/2022 |
2.0.6-prerelease.11 | 102 | 9/5/2022 |
2.0.6-prerelease.10 | 101 | 9/5/2022 |
2.0.6-prerelease.8 | 108 | 9/5/2022 |
2.0.6-prerelease.7 | 107 | 9/5/2022 |
2.0.6-prerelease.6 | 107 | 9/5/2022 |
2.0.6-prerelease.4 | 115 | 9/5/2022 |
2.0.6-prerelease | 152 | 9/5/2022 |
2.0.5 | 395 | 9/4/2022 |
2.0.3 | 419 | 9/4/2022 |
2.0.1 | 438 | 9/4/2022 |
1.6.2 | 485 | 4/23/2022 |
1.6.1 | 453 | 4/22/2022 |
1.6.0 | 485 | 4/22/2022 |
1.5.5 | 1,644 | 3/7/2022 |
1.5.4 | 443 | 3/7/2022 |
1.5.3 | 425 | 3/7/2022 |
1.5.2 | 450 | 3/5/2022 |
1.5.1 | 452 | 2/23/2022 |
1.5.0 | 1,179 | 2/22/2022 |
1.4.8 | 725 | 2/21/2022 |
1.4.7 | 436 | 2/19/2022 |
1.4.6 | 450 | 2/19/2022 |
1.4.5 | 692 | 1/9/2022 |
1.4.4 | 440 | 1/9/2022 |
1.4.3 | 1,002 | 1/4/2022 |
1.4.2 | 440 | 1/2/2022 |
1.4.1 | 312 | 1/1/2022 |
1.4.0 | 316 | 1/1/2022 |
1.3.6 | 406 | 1/1/2022 |
1.3.5 | 508 | 12/25/2021 |
1.3.4 | 450 | 12/13/2021 |
1.3.3 | 327 | 12/6/2021 |
1.3.2 | 396 | 11/16/2021 |
1.3.1 | 374 | 11/16/2021 |
1.3.0 | 352 | 11/14/2021 |
1.2.7 | 355 | 11/10/2021 |
1.2.6 | 411 | 11/8/2021 |
1.2.5 | 336 | 11/3/2021 |
1.2.4 | 368 | 11/2/2021 |
1.2.3 | 374 | 10/26/2021 |
1.2.2 | 411 | 10/25/2021 |
1.2.1 | 349 | 10/21/2021 |
1.2.0 | 325 | 10/21/2021 |
1.1.12 | 1,493 | 9/1/2021 |
1.1.11 | 338 | 9/1/2021 |
1.1.10 | 342 | 9/1/2021 |
1.1.9 | 346 | 9/1/2021 |
1.1.8 | 1,035 | 8/26/2021 |
1.1.7 | 352 | 8/26/2021 |
1.1.6 | 349 | 8/26/2021 |
1.1.5 | 343 | 8/26/2021 |
1.1.4 | 362 | 8/26/2021 |
1.1.3 | 506 | 8/25/2021 |
1.1.2 | 341 | 8/25/2021 |
1.1.1 | 335 | 8/25/2021 |
1.1.0 | 331 | 8/25/2021 |
1.0.92 | 976 | 8/18/2021 |
1.0.91 | 969 | 8/9/2021 |
1.0.90 | 643 | 8/4/2021 |
1.0.89 | 479 | 7/19/2021 |
1.0.88 | 348 | 7/19/2021 |
1.0.87 | 1,074 | 7/3/2021 |
1.0.86 | 497 | 7/2/2021 |
1.0.85 | 413 | 7/1/2021 |
1.0.84 | 533 | 6/30/2021 |
1.0.83 | 375 | 6/28/2021 |
1.0.82 | 365 | 6/28/2021 |
1.0.81 | 686 | 6/27/2021 |
1.0.80 | 473 | 6/27/2021 |
1.0.79 | 488 | 6/27/2021 |
1.0.78 | 374 | 6/16/2021 |
1.0.77 | 1,084 | 6/16/2021 |
1.0.76 | 618 | 6/15/2021 |
1.0.75 | 767 | 6/15/2021 |
1.0.74 | 408 | 6/15/2021 |
1.0.73 | 413 | 6/15/2021 |
1.0.72 | 424 | 6/15/2021 |
1.0.71 | 411 | 6/15/2021 |
1.0.70 | 628 | 6/15/2021 |
1.0.69 | 368 | 6/15/2021 |
1.0.68 | 506 | 6/15/2021 |
1.0.67 | 422 | 6/14/2021 |
1.0.66 | 421 | 6/14/2021 |
1.0.65 | 666 | 6/14/2021 |
1.0.64 | 526 | 6/13/2021 |
1.0.63 | 380 | 6/13/2021 |
1.0.62 | 385 | 6/13/2021 |
1.0.61 | 420 | 6/13/2021 |
1.0.60 | 498 | 6/13/2021 |
1.0.59 | 391 | 6/13/2021 |
1.0.58 | 713 | 6/13/2021 |
1.0.57 | 536 | 6/12/2021 |
1.0.56 | 668 | 6/12/2021 |
1.0.55 | 436 | 6/12/2021 |
1.0.54 | 1,198 | 6/10/2021 |
1.0.53 | 416 | 6/10/2021 |
1.0.52 | 447 | 6/10/2021 |
1.0.51 | 405 | 6/10/2021 |
1.0.49 | 407 | 6/10/2021 |
1.0.48 | 402 | 6/9/2021 |
1.0.47 | 345 | 6/9/2021 |
1.0.46 | 336 | 6/9/2021 |
1.0.45 | 337 | 6/9/2021 |
1.0.44 | 338 | 6/9/2021 |
1.0.43 | 1,515 | 6/8/2021 |
1.0.42 | 1,449 | 6/6/2021 |
1.0.41 | 479 | 6/6/2021 |
1.0.40 | 479 | 6/6/2021 |
1.0.39 | 491 | 6/6/2021 |
1.0.38 | 361 | 6/6/2021 |
1.0.37 | 507 | 6/6/2021 |
1.0.36 | 372 | 6/6/2021 |
1.0.35 | 350 | 6/6/2021 |
1.0.34 | 464 | 6/6/2021 |
1.0.33 | 371 | 6/6/2021 |
1.0.32 | 639 | 6/5/2021 |
1.0.31 | 794 | 6/5/2021 |
1.0.30 | 547 | 6/5/2021 |
1.0.29 | 487 | 6/5/2021 |
1.0.28 | 524 | 6/4/2021 |
1.0.27 | 593 | 6/4/2021 |
1.0.26 | 330 | 6/4/2021 |
1.0.25 | 368 | 6/4/2021 |
1.0.24 | 380 | 6/4/2021 |
1.0.23 | 516 | 6/3/2021 |
1.0.22 | 863 | 6/3/2021 |
1.0.21 | 365 | 6/3/2021 |
1.0.20 | 727 | 6/2/2021 |
1.0.19 | 697 | 6/2/2021 |
1.0.18 | 354 | 6/2/2021 |
1.0.17 | 356 | 6/2/2021 |
1.0.16 | 2,097 | 5/20/2021 |
1.0.15 | 348 | 5/19/2021 |
1.0.14 | 354 | 5/18/2021 |
1.0.13 | 333 | 5/18/2021 |
1.0.12 | 362 | 5/18/2021 |
1.0.11 | 347 | 5/17/2021 |
1.0.10 | 819 | 5/13/2021 |
1.0.9 | 485 | 5/13/2021 |
1.0.8 | 342 | 5/13/2021 |
1.0.7 | 669 | 5/11/2021 |
1.0.6 | 318 | 5/11/2021 |
1.0.5 | 323 | 5/11/2021 |
1.0.4 | 336 | 5/11/2021 |
1.0.3 | 490 | 5/8/2021 |
1.0.2 | 369 | 5/8/2021 |
1.0.1 | 354 | 5/8/2021 |
1.0.0 | 466 | 5/8/2021 |
* Fixed ArgumentNullException wrong parameter names