Tuesday, December 8, 2009

WPF MessageBox - Custom control (Updated with "Show Details" expander)


I updated my MessageBox control code to include a “Show Details” progressive disclosure tab to show inner exceptions or details on the message displayed. The new option can be activated by calling the overloaded Show() method as
__Result = WPFMessageBox.Show("NullReference Exception",

                        "Object reference not set to an instance of an object",

                        @"at JetBrains.ActionManagement.UpdatableAction.Update(IDataContext context) in c:\Agent\work\abf124657aeded22\Platform\src\UI\src\ActionSystem\Action\UpdatableAction.cs:line 82 at JetBrains.ActionManagement.ActionManagerBase.UpdateAction(IUpdatableAction action) in c:\Agent\work\abf124657aeded22\Platform\src\UI\src\ActionSystem\ActionManager\ActionManagerBase.cs:line 726 at JetBrains.VsIntegration.ActionManagement.VsActionManager.UpdateAction(IUpdatableAction action) in c:\Agent\work\abf124657aeded22\Platform\src\VSIntegration\src\ActionManagement\VSActionManager.cs:line 1252"

                        WPFMessageBoxButtons.OK, WPFMessageBoxImage.Error);
Screen shots:

Post a comment with your email address and I’ll email the updated source code for the message box control.
I have uploaded the source code to codeplex. You can get it from here
http://prajeeshprathap.codeplex.com/SourceControl/PatchList.aspx

33 comments:

Anonymous said...

Great work! Please send the source code to borlip@dodo.com.au

Fredrik said...

Very good work! I was looking for this thing exactly. Can you please send me the src?

Just one question: Why did you choose to implement your own enums rather than using the enums that the standard MessageBox uses, Ie: MessageBoxOptions, MessageBoxResults, MessageBoxButton, MessageBoxIcon etc. Keeping the standard enumns would make it so much easier to migrate code from the old MessageBox over to your implementation?

Again, really good work, I cannot wait to get my hands on it!

Cheers,
Fredrik

Prajeesh said...

Hi Fredrik,
Could you please leave ur email Id for the source code?

Fredrik said...

Hi Prajeesh,

Sure my email is: fredrik.peraldi@kershnerconsulting.com

Looking forward to see the sourcecode!

Cheers,
Fredrik

Michelle said...

Great implentation - I'd love to take a look at it! Can you send the code to michelle.l.smiley@gmail.com?

Anonymous said...

Very good article!
Can I get the code at tedyusa2000@yahoo.ca ?

P.S. Happy New Year!

Anonymous said...

very good ..... can i ask you send the src code to amin_r_amin@yahoo.com

Anonymous said...

Wow I've been looking for this kind of implementation can you send me the source code.

The may name is jAY Gabilo and this is may email jay.gabilo@gmail.com



Thanks

Anonymous said...

Wow this looks greate I've been looking for this kind of message box implementation. Can you send me the source code.


jAY Gabilo
jay.gabilo@gmail.com

Anonymous said...

Hi Prajeesh,
This looks like what I need at the moment. Could you please send me the source code to marko@top.net.nz.

Thanks,
Marko

Anonymous said...

Hi Prajeesh,

This is very good; exactly what I need. Could you please send the source code to marko@top.net.nz.

Thanks,
Marko

Anonymous said...

Looks like what I need. Why microsoft have not developed one is beyond me!!

Could you please post src to brett@coomoora.com,

thanks

Anonymous said...

Really good work, I would likely receive the source code.
Can you please mail it to following address?
Arrakis79@hotmail.de

Cheers,
Frank

Anonymous said...

hi,

thats a good one, can you please mail me the source to jikubhai@yahoo.com ....
thank you

Anonymous said...

Good work!

This looks like the ticket for me, could you email me the source please?

marcus_atkins@hotmail.com

trialBoy said...

hi, I want the source code.
Thanks.
My mail: trialboy@live.cn

Anonymous said...

Very good, please send source to
pirotbus99@yahoo.com
Thanks!!

Anonymous said...

Nice job, can you share it?
vytazs@yahoo.com

Anonymous said...

Looks great! Can You please send me the source? Thank You.

Greetings from Germany.
schmidtering(at)arcor.de

Frank said...

Thank you for sending me the source.

telecino@gmail.com

Raman said...

please send the source code to the following address. ramanpk@hotmail.com

Biki said...

Hi,

Can you please send me the source code for the show detail option in message box.

mail id - mishra.pk.bikram@gmail.com

thanks

Biki said...
This comment has been removed by the author.
Anonymous said...

Great implentation - Its really Nice.I would say Great job. Can you send the code to bilalwani@gmail.com

Anonymous said...

Send the source to truxtun35 AT yahoo.com Thanks!

Biki said...

Hi,
Thanks for sending me the source code.
In your source code I pasted the overloaded show method as per your instruction. But it is giving me an error that "No overload for method 'show' takes five arguments".
And also I searched for the key "Show Details" and found nothing.
Can you please tell me if i have missed any steps?

Anonymous said...

Can you please send me the Source Code.

Frank said...

Is there another version of the code ? My copy got some "errors".

1. Top left icon does not disapear (i'm on XP !)
2. No option to show the "expandable" section.
3. Window is not centered, even more it never display at the same place ?

Prajeesh said...

I have uploaded the source code to codeplex. You can get it from here
http://prajeeshprathap.codeplex.com/SourceControl/PatchList.aspx

Dinesh said...

Hey Prajeesh custom Message Box looks great. I really liked the way You have implemented it using delegates. I found a small problem though. It runs perfectly when break points are not applied but when they are applied (wanted to navigate through F11) the entire application is getting frozen. Could not find whats wrong. If u find the problem let me know. Can u send the latest source code to my mail: dineshreddy.blog@gmail.com

Thnx

Dinesh said...

Hey Prajeesh, I just found that the owner of the message box is not set and when used on dual screen with the original window moved to other screen the message box shows up on the other screen rather than on the parent window. I just set the owner = application.current.mainwindow and it works perfect. and strangely the previously reported problem (problem with F11 navigation) is no more.

Thnx

Markus said...

Hi, very cool Messagebox.
Can you say me why the MessageBox doesn't work, if I try to run it modeless? I change the ShowDialog() methode to Show() and the Messagebox doesn't work.
Can you give me some helb?

Thanks Markus

Anonymous said...

Please sent the source code to this mail
mtz_gaafar@yahoo.com
Thanks alot !!