本文整理汇总了C#中ContentDialog.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# ContentDialog.SetBinding方法的具体用法?C# ContentDialog.SetBinding怎么用?C# ContentDialog.SetBinding使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类ContentDialog
的用法示例。
在下文中一共展示了ContentDialog.SetBinding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DoSignInInUIThread
private async Task<Credential> DoSignInInUIThread(CredentialRequestInfo credentialRequestInfo)
{
var signInDialog = this;
// Create the ContentDialog that contains the SignInDialog
var contentDialog = new ContentDialog
{
SecondaryButtonText = "cancel",
PrimaryButtonText = "sign in",
FullSizeDesired = true,
Content = signInDialog,
};
contentDialog.PrimaryButtonClick += ContentDialogOnPrimaryButtonClick;
// Bind the Title so the ContentDialog Title is the SignInDialog title (that will be initialized later)
contentDialog.SetBinding(ContentDialog.TitleProperty, new Binding { Path = new PropertyPath("Title"), Source = signInDialog });
contentDialog.SetBinding(ContentDialog.IsPrimaryButtonEnabledProperty, new Binding { Path = new PropertyPath("IsReady"), Source = signInDialog });
contentDialog.Closed += ContentDialogOnClosed; // be sure the SignInDialog is deactivated when pressing back button
// Show the content dialog
var _ = contentDialog.ShowAsync(); // don't await else that would block here
// Wait for the creation of the credential
Credential crd;
try
{
crd = await signInDialog.WaitForCredentialAsync(credentialRequestInfo);
}
finally
{
// Close the content dialog
contentDialog.Hide();
}
return crd;
}
示例2: CopyBindings
private void CopyBindings(ContentDialog dialog, DependencyProperty property, string path)
{
Contract.Requires(dialog != null, nameof(dialog));
Contract.Requires(property != null, nameof(property));
dialog.SetBinding(property, new Binding
{
Source = this,
Path = new PropertyPath(path)
});
}