Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

MessageBoxImage is not shown #1751

Open
BlyZeYT opened this issue Jun 3, 2023 · 8 comments
Open

MessageBoxImage is not shown #1751

BlyZeYT opened this issue Jun 3, 2023 · 8 comments

Comments

@BlyZeYT
Copy link

BlyZeYT commented Jun 3, 2023

When I use this method the MessageBox shows perfectly except there is no image shown.

This is my code:

Xceed.Wpf.Toolkit.MessageBox.Show(
            "My message",
            "My caption",
            MessageBoxButton.OKCancel,
            MessageBoxImage.Error,
            MessageBoxResult.Cancel);

This is my style:

<Style TargetType="{x:Type xctk:MessageBox}">
            <Setter Property="Background" Value="{DynamicResource Background}"/>
            <Setter Property="WindowBackground" Value="{DynamicResource Text}"/>
            <Setter Property="ButtonRegionBackground" Value="{DynamicResource Background}"/>
            <Setter Property="Foreground" Value="{DynamicResource Text}"/>
            <Setter Property="CaptionForeground" Value="{DynamicResource Background}"/>
            <Setter Property="BorderThickness" Value="{StaticResource BorderThickness}"/>
            <Setter Property="BorderBrush" Value="{DynamicResource Text}"/>
            <Setter Property="CancelButtonStyle" Value="{StaticResource ButtonStyle}"/>
            <Setter Property="OkButtonStyle" Value="{StaticResource ButtonStyle}"/>
            <Setter Property="CancelButtonContent" Value="Close"/>
            <Setter Property="OkButtonContent" Value="Okay"/>
            <Setter Property="CloseButtonStyle" Value="{StaticResource CloseButtonStyle}"/>
            <Setter Property="WindowBorderThickness" Value="{StaticResource BorderThickness}"/>
            <Setter Property="WindowBorderBrush" Value="{DynamicResource Background}"/>
        </Style>
@XceedDanP
Copy link
Collaborator

XceedDanP commented Jun 9, 2023 via email

@BlyZeYT
Copy link
Author

BlyZeYT commented Jun 9, 2023

Sorry, I can't seem to reproduce this in a simpler case (I don't have your details about your dynamic resources) Have you commented out the setters to see if anything there might be interfering?

________________________________ From: Leon Schimmel @.> Sent: Saturday, June 3, 2023 5:22 PM To: xceedsoftware/wpftoolkit @.> Cc: Subscribed @.> Subject: [xceedsoftware/wpftoolkit] MessageBoxImage is not shown (Issue #1751) When I use this method the MessageBox shows perfectly except there is no image shown. This is my code: Xceed.Wpf.Toolkit.MessageBox.Show( "My message", "My caption", MessageBoxButton.OKCancel, MessageBoxImage.Error, MessageBoxResult.Cancel); This is my style <Style TargetType="{x:Type xctk:MessageBox}"> </Style> — Reply to this email directly, view it on GitHub<#1751>, or unsubscribehttps://github.com/notifications/unsubscribe-auth/A7M3JW53P6CZ2FZKOAQHLCLXJOTIFANCNFSM6AAAAAAYZQLNT4. You are receiving this because you are subscribed to this thread.Message ID: @.>

It doesn't even work when no Style is applied.

@XceedDanP
Copy link
Collaborator

XceedDanP commented Jun 9, 2023 via email

@BlyZeYT
Copy link
Author

BlyZeYT commented Jun 9, 2023

Its not showing in any situation.
I'm using Version 4.5.0 of the Extended.Wpf.Toolkit
I'm using .NET 7
There is no other style applied.
It doesn't work in a clean project too.

@BlyZeYT
Copy link
Author

BlyZeYT commented Jun 9, 2023

I'll try in .NET 6

@BlyZeYT
Copy link
Author

BlyZeYT commented Jun 9, 2023

Doesn't work in .NET 6 either

@SteveA74
Copy link

I have the same issue, it seems to have been broken since V4.40 if I roll back the NuGet package to 4.3.0 it works.

In my style i have

<Style TargetType="xctk:MessageBox"> </Style>

In code i am calling
Xceed.Wpf.Toolkit.MessageBox.Show("Please select an option", "Options",MessageBoxButton.OK,MessageBoxImage.Information);

I am running this in a WPF C# .NET6 project.

@XceedBoucherS
Copy link
Collaborator

Hi,

You are right. This doesn't work in .NET5+. It currently only works in .NETFramework.
It will be fixed in v4.6.

In the meantime, if you have the source code, you can go in file Xceed.Wpf.Toolkit/MessageBox/Implementation/MessageBox.cs,
in method : SetImageSource( MessageBoxImage image )
Replace:
this.ImageSource = new BitmapImage( new Uri( String.Format( "/Xceed.Wpf.Toolkit;component/MessageBox/Icons/{0}", iconName ), UriKind.RelativeOrAbsolute ) );
with
this.ImageSource = new BitmapImage( new Uri( String.Format( "/Xceed.Wpf.Toolkit.NET5;component/MessageBox/Icons/{0}", iconName ), UriKind.RelativeOrAbsolute ) );

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants