Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings
/wpfPublic

[API Proposal]: Make additional MessageBoxButton and MessagBoxResult values available #9613

Closed
Assignees
siagupta0202
Labels
api-approvedAPI was approved in API review, it can be implemented
@bstordrup

Description

@bstordrup

Background and motivation

Issue#5795 suggests getting moreMessageBoxButton andMessageBoxResult values available and bringing Wpf repository more in sync with what is available in WinForms repository.

It will also make it easier to migrate from WinForms to WPF that you can practically directly make the same call to show a MessageBox in WPF as in WinForms.

Both repositories are calling into the sameMessageBox function in Windows, so it should not be a technical problem to handle this.

API Proposal

ExtendMessageBoxButton andMessageBoxResult enumerations

AddAbortRetryIgnore,RetryCancel andCancelTryContinue to theMessageBoxButton enumeration:

namespace System.Windows{    public enum MessageBoxButton    {        OK = 0,        OKCancel = 1,+       AbortRetryIgnore = 2,        YesNoCancel = 3,        YesNo = 4,+       RetryCancel = 5,+       CancelTryContinue = 6,    }}

Also addAbort,Retry,Ignore,TryAgain andContinue to theMessageBoxResult enumeration:

namespace System.Windows{    public enum MessageBoxResult    {        None = 0,        OK = 1,        Cancel = 2,+       Abort = 3,+       Retry = 4,+       Ignore = 5,        Yes = 6,        No = 7,+       TryAgain = 10,+       Continue = 11,    }}

API Usage

// Call the MessageBox.Show with additional parametersMessageBoxResultresult=MessageBox.Show("Operation timed out. What would you like to do?","My application",MessageBoxButton.RetryCancel,MessageBoxIcon.Question,MessageBoxResult.Retry);if(result==MessageBoxResult.Retry){/// Perfom code to retry operation}else{// Log cancel request and exit}

Alternative Designs

No response

Risks

In connection with the extra enumeration values, I don't see a risk, since the values already exist in the underlying Windows API (1).

  1. https://learn.microsoft.com/en-us/windows/win32/api/winuser/nf-winuser-messagebox

Metadata

Metadata

Assignees

Labels

api-approvedAPI was approved in API review, it can be implemented

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions


    [8]ページ先頭

    ©2009-2025 Movatter.jp