Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
FIx - Add ReactiveFlyoutPage to Maui (#3720)
<!-- 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 #3719 **What is the current behavior?** <!-- You can also link to an open issue here. --> Maui is missing ReactiveFlyoutPage **What is the new behavior?** <!-- If this is a feature change --> Added ReactiveFlyoutPage to Maui Updated Verify.Xunit and made code changes as required. **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**:
- Loading branch information
1 parent
9c36b0f
commit e28392d
Showing
9 changed files
with
56 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
// 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 Microsoft.Maui.Controls; | ||
|
||
namespace ReactiveUI.Maui; | ||
|
||
/// <summary> | ||
/// Reactive Flyout Page. | ||
/// </summary> | ||
/// <typeparam name="TViewModel">The type of the view model.</typeparam> | ||
/// <seealso cref="FlyoutPage" /> | ||
/// <seealso cref="IViewFor{TViewModel}" /> | ||
public class ReactiveFlyoutPage<TViewModel> : FlyoutPage, IViewFor<TViewModel> | ||
where TViewModel : class | ||
{ | ||
/// <summary> | ||
/// The view model bindable property. | ||
/// </summary> | ||
public static readonly BindableProperty ViewModelProperty = BindableProperty.Create( | ||
nameof(ViewModel), | ||
typeof(TViewModel), | ||
typeof(ReactiveFlyoutPage<TViewModel>), | ||
default(TViewModel), | ||
BindingMode.OneWay, | ||
propertyChanged: OnViewModelChanged); | ||
|
||
/// <summary> | ||
/// Gets or sets the ViewModel to display. | ||
/// </summary> | ||
public TViewModel? ViewModel | ||
{ | ||
get => (TViewModel)GetValue(ViewModelProperty); | ||
set => SetValue(ViewModelProperty, value); | ||
} | ||
|
||
/// <inheritdoc/> | ||
object? IViewFor.ViewModel | ||
{ | ||
get => ViewModel; | ||
set => ViewModel = (TViewModel?)value; | ||
} | ||
|
||
/// <inheritdoc/> | ||
protected override void OnBindingContextChanged() | ||
{ | ||
base.OnBindingContextChanged(); | ||
ViewModel = BindingContext as TViewModel; | ||
} | ||
|
||
private static void OnViewModelChanged(BindableObject bindableObject, object oldValue, object newValue) => bindableObject.BindingContext = newValue; | ||
} |
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