Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Feature: Add ReactiveProperty #3729

Merged
merged 4 commits into from Feb 15, 2024
Merged

Feature: Add ReactiveProperty #3729

merged 4 commits into from Feb 15, 2024

Conversation

ChrisPulman
Copy link
Member

What kind of change does this PR introduce?

Feature

What is the current behavior?

Boiler plate code is required to get an Observable Property

What is the new behavior?

A quick and simple ReactiveProperty has been added to suit a small number of properties.
ReactiveProperty is a two way bindable declarative observable property with imperative get set Value.
Useful when mixing different UI Frameworks without the requirement for a ReactiveObject based ViewModel

Declare as

IReactiveProperty<string> MyProperty { get; } = new ReactiveProperty<string>();

Use declarativly

MyProperty.Subscribe(x => // use x as desired);

Use imperativly

MyProperty.Value = "Set the value";
var value = MyProperty.Value;

Use XAML Bindings

{Binding MyProperty.Value}

What might this PR break?

None

Please check if the PR fulfills these requirements

  • Tests for the changes have been added (for bug fixes / features)
  • Docs have been added / updated (for bug fixes / features)

Other information:

A two way bindable declarative observable property with imperative get set.
@glennawatson
Copy link
Contributor

glennawatson commented Feb 15, 2024

Wonder if additions like this, which isn't required for the core code, should go into a ReactiveUI.Extras NuGet package or something.

@ChrisPulman
Copy link
Member Author

Wonder if additions like this, which isn't required for the core code, should go into a ReactiveUI.Extras NuGet package or something.

I think the key thing is to have this within the .Net Foundation so that people can use it in certain situations where they cant use other sources of packages.

As its such a small addition I thought that having it in the base allows it to be used in any implementation.

If it needs to be in a separate package then i can move it to another project within ReactiveUI.

@ChrisPulman ChrisPulman merged commit cec4cca into main Feb 15, 2024
1 check passed
@ChrisPulman ChrisPulman deleted the FeatureReactiveProperty branch February 15, 2024 18:15
Copy link

github-actions bot commented Mar 1, 2024

This pull request has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators Mar 1, 2024
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants