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 (#3677)
<!-- 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? Fix for #3644 What is the current behavior? 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? Alter `BindCommand` where clause relaxing to `IViewFor`. NOTE: Bind only requires `IViewFor` and `IViewFor<TViewModel>` inherits `IViewFor` therefore `BindCommand` is now relaxed to `IViewFor` in the same way as Bind. add `ReactiveUserControlNonGeneric` for WinForms inherits `IViewFor` What might this PR break? API Change 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
f3e21de
commit 23334c1
Showing
16 changed files
with
118 additions
and
64 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); | ||
} | ||
} |
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
Oops, something went wrong.