本文整理匯總了C#中Windows.UI.Xaml.Controls.Page.InitializeBindings方法的典型用法代碼示例。如果您正苦於以下問題:C# Page.InitializeBindings方法的具體用法?C# Page.InitializeBindings怎麽用?C# Page.InitializeBindings使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Windows.UI.Xaml.Controls.Page
的用法示例。
在下文中一共展示了Page.InitializeBindings方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。
示例1: NavedToAsync
public async Task NavedToAsync(object viewmodel, NavigationMode mode, Page sourcePage, Type sourceType, object sourceParameter, Page targetPage, Type targetType, object targetParameter)
{
Services.NavigationService.NavigationService.DebugWrite();
if (targetPage == null)
{
throw new ArgumentNullException(nameof(targetPage));
}
if (mode == NavigationMode.New)
{
PageState(targetPage).Clear();
}
if (viewmodel == null)
{
return;
}
else if (viewmodel is Classic.INavigatedAwareAsync)
{
var vm = viewmodel as Classic.INavigatedAwareAsync;
await vm?.OnNavigatedToAsync(targetParameter, mode, PageState(targetPage));
}
else if (viewmodel is Portable.INavigatedAware)
{
var parameters = new Portable.NavigationParameters();
parameters.Add("NavigationMode", mode.ToPrismNavigationMode());
parameters.Add("SourceType", sourceType);
parameters.Add("SourceParameter", sourceParameter);
parameters.Add("TargetType", targetType);
parameters.Add("TargetParameter", targetParameter);
var vm = viewmodel as Portable.INavigatedAware;
vm?.OnNavigatedTo(parameters);
}
else if (viewmodel is Portable.INavigatedAwareAsync)
{
var parameters = new Portable.NavigationParameters();
parameters.Add("NavigationMode", mode.ToPrismNavigationMode());
parameters.Add("SourceType", sourceType);
parameters.Add("SourceParameter", sourceParameter);
parameters.Add("TargetType", targetType);
parameters.Add("TargetParameter", targetParameter);
var vm = viewmodel as Portable.INavigatedAwareAsync;
await vm?.OnNavigatedToAsync(parameters);
}
targetPage.InitializeBindings();
targetPage.UpdateBindings();
}