C# WPF现代用户界面-带图标的DialogResult
我的问题与WPF桌面应用程序的现代UI模板有关。 我的目标是创建一个带有图标图像的C# WPF现代用户界面-带图标的DialogResult,c#,wpf,modern-ui,C#,Wpf,Modern Ui,我的问题与WPF桌面应用程序的现代UI模板有关。 我的目标是创建一个带有图标图像的对话框result ModernDialog=新建ModernDialog(); Dialog.Title=“Dialog-EXAMPLE”; Dialog.Buttons=新建按钮[]{Dialog.OkButton,Dialog.CancelButton}; Dialog.Content=“测试新的DialogResult”; Dialog.ShowDialog(); //Dialog.Icon=???; 上
对话框result
ModernDialog=新建ModernDialog();
Dialog.Title=“Dialog-EXAMPLE”;
Dialog.Buttons=新建按钮[]{Dialog.OkButton,Dialog.CancelButton};
Dialog.Content=“测试新的DialogResult”;
Dialog.ShowDialog();
//Dialog.Icon=???;
上述代码将创建以下对话框结果
窗口:
我正在寻找类似于MessageBoxImage
值的内容:
我必须使用对话框result
使内容与我的现代UI界面相匹配。。。关于如何插入图像文件/SVG有什么想法吗
谢谢。图标属性用于设置任务栏中窗口的图像。它不是用来设置的,要实现所需的功能,您需要
- 添加一个新的ModernDialog页面,这应该很容易,因为您使用的是VS modern UI模板
- 通过其xaml自定义
,并使其看起来符合您的需要messageDialog
<mui:ModernDialog x:Class="ModernUIApp1.ModernDialogMessage" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:d="http://schemas.microsoft.com/expression/blend/2008" xmlns:mui="http://firstfloorsoftware.com/ModernUI" mc:Ignorable="d" d:DesignHeight="300" d:DesignWidth="300" Title="DIALOG EXAMPLE" > <Grid> <Grid.ColumnDefinitions> <ColumnDefinition Width="Auto"/> <ColumnDefinition Width="*"/> </Grid.ColumnDefinitions> <Image Source="imageIcon.jpg" Width="40"></Image> <TextBlock Grid.Column="1" Text="Testing a new DialogResult" VerticalAlignment="Center" HorizontalAlignment="Left"></TextBlock> </Grid> </mui:ModernDialog>
var msg = new ModernDialogMessage();
msg.ShowDialog();