Open nonew opened 1 year ago
I have two questions:
I write customized ConsentDialog.xaml like this:
<ui:ContentDialog xmlns:ui="clr-namespace:ModernWpf.Controls;assembly=ModernWpf.Controls" x:Class="MyDialogApp.ConsentDialog" .... mc:Ignorable="d">
<ui:ContentDialog.Resources> ... </ui:ContentDialog.Resources> <ui:ContentDialog.Style> ... </ui:ContentDialog.Style>
</ui:ContentDialog>
And show the dialog like this: public static async Task ShowAsync(string title, string content, string primaryBtnText, string secondaryBtnText) { try { Close(); _dialog = new ConsentDialog { Title = title, Content = content, PrimaryButtonText = primaryBtnText, SecondaryButtonText = secondaryBtnText }; await _dialog.ShowAsync(); } catch (Exception ex) { Logger.Error(ex.Message); } return _result; }
I have two questions:
I write customized ConsentDialog.xaml like this:
<ui:ContentDialog xmlns:ui="clr-namespace:ModernWpf.Controls;assembly=ModernWpf.Controls" x:Class="MyDialogApp.ConsentDialog" .... mc:Ignorable="d">
</ui:ContentDialog>
And show the dialog like this: public static async Task ShowAsync(string title, string content, string primaryBtnText, string secondaryBtnText)
{
try
{
Close();
_dialog = new ConsentDialog
{
Title = title,
Content = content,
PrimaryButtonText = primaryBtnText,
SecondaryButtonText = secondaryBtnText
};
await _dialog.ShowAsync();
}
catch (Exception ex)
{
Logger.Error(ex.Message);
}
return _result;
}