Mobile/CafeLib.Mobile/Extensions/PageExtensions.cs
/// <summary>
/// Set the view model to the binding context of the page.
/// </summary>
/// <typeparam name="T">view model type</typeparam>
/// <param name="page">current page</param>
/// <param name="viewModel">view model</param>
Set the view model to the binding context of the page.
Set the view model to the binding context of the page .
public static void SetViewModel<T>(this Page page, T viewModel) where T : BaseViewModel
        {
            if (page.BindingContext == viewModel) return;
            page.BindingContext = null;
            page.BindingContext = viewModel;
        }
public static void SetViewModel < T > ( this Page page , T viewModel ) where T : BaseViewModel { if ( page . BindingContext == viewModel ) return ; page . BindingContext = null ; page . BindingContext = viewModel ; }
Set the view model to the binding context of the page.
Set the view model to the binding context of the page .
Page
this
viewModel
T
None
page
None
typeparam
view model type
view model type