Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
breaking change: Make Bind use non-generic IViewFor (#3676)
<!-- Please be sure to read the [Contribute](https://github.com/reactiveui/reactiveui#contribute) section of the README --> **What kind of change does this PR introduce?** <!-- Bug fix, feature, docs update, ... --> Fix for #3644 **What is the current behavior?** <!-- You can also link to an open issue here. --> BindCommand requires a view inherited from `IViewFor<TViewModel>` ReactiveUserControl inherits `IViewFor<TViewModel>` which requires Generics which WinForms does not work well with. **What is the new behavior?** <!-- If this is a feature change --> Add BindCommandNonGeneric this is to avoid the request of not changing the existing code, therefore adding to the available options. NOTE: Bind only requires `IViewFor` and `IViewFor<TViewModel>` inherits `IViewFor` therefore would still be an API change if BindCommand were relaxed to IViewFor in the same way as Bind, but perhaps the best route. add ReactiveUserControlNonGeneric for WinForms - inherits `IViewFor` **What might this PR break?** Non due to new functions **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**:
- Loading branch information
1 parent
45a92af
commit 246e8ef
Showing
16 changed files
with
487 additions
and
35 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
23 changes: 23 additions & 0 deletions
23
src/ReactiveUI.Winforms/ReactiveUserControlNonGeneric.Designer.cs
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
// Copyright (c) 2023 .NET Foundation and Contributors. All rights reserved. | ||
// Licensed to the .NET Foundation under one or more agreements. | ||
// The .NET Foundation licenses this file to you under the MIT license. | ||
// See the LICENSE file in the project root for full license information. | ||
|
||
using System.Windows.Forms; | ||
|
||
namespace ReactiveUI.Winforms; | ||
|
||
/// <summary> | ||
/// This is an UserControl that is both and UserControl and has a ReactiveObject powers | ||
/// (i.e. you can call RaiseAndSetIfChanged). | ||
/// </summary> | ||
/// <seealso cref="System.Windows.Forms.UserControl" /> | ||
/// <seealso cref="ReactiveUI.IViewFor" /> | ||
public partial class ReactiveUserControlNonGeneric : UserControl, IViewFor | ||
{ | ||
/// <summary> | ||
/// Initializes a new instance of the <see cref="ReactiveUserControlNonGeneric"/> class. | ||
/// </summary> | ||
public ReactiveUserControlNonGeneric() => InitializeComponent(); | ||
|
||
/// <inheritdoc/> | ||
object? IViewFor.ViewModel { get; set; } | ||
|
||
/// <summary> | ||
/// Clean up any resources being used. | ||
/// </summary> | ||
/// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> | ||
protected override void Dispose(bool disposing) | ||
{ | ||
if (disposing) | ||
{ | ||
components?.Dispose(); | ||
} | ||
|
||
base.Dispose(disposing); | ||
} | ||
} |
Oops, something went wrong.