My question is related to the Modern UI template for WPF Desktop applications.
My goal is to create a DialogResult
with an icon image.
ModernDialog Dialog = new ModernDialog();
Dialog.Title = "DIALOG EXAMPLE";
Dialog.Buttons = new Button[] { Dialog.OkButton, Dialog.CancelButton};
Dialog.Content = "Testing a new DialogResult";
Dialog.ShowDialog();
//Dialog.Icon = ???;
The code above will create the following DialogResult
window:
I am looking for something similar to the MessageBoxImage
value:
I must use the DialogResult
to fit the content with my Modern UI interface... any ideas on how insert an image file/SVG ?
Thank you.
The Icon
property is used to set the image of the window in the taskbar it isn't meant for that, to achieve what you are looking for you need to
Customize the messageDialog
through its xaml and make it looks the way that you want
<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>
show it when needed
var msg = new ModernDialogMessage();
msg.ShowDialog();