Open memoarfaa opened 1 month ago
@memoarfaa in .NET 5 we added support for the OS TaskDialog
which allows for lots of customization. I think that's the direction we would rather developers go.
@Olina-Zhang @LeafShi1 can you verify for me that TaskDialog
API is able to respond to OS dark mode?
@memoarfaa in .NET 5 we added support for the OS
TaskDialog
which allows for lots of customization.@merriemcgaw Yes that is true but each has its own use If I need a lot of customization I use TaskDialog otherwise I use MessageBox 1- Can I use TaskDialog to display a simple message withowt extra coding. For example, I want to display a simple message to tell the user that the database login failed.
private void CheckConnectionStatus()
{
try
{
if (_sqlConnection.State != ConnectionState.Open)
{
_sqlConnection.Open();
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Failed to Open Connection");
}
}
This is not about OS dark mode only. But the question is Winforms has a way to show simple message that can be localized and color without extra coding?
I saw a similar issue still open in Wpf. https://github.com/dotnet/wpf/issues/5967 Most opinions say that Messagebox in winForms is better than Wpf because it has manifest. In fact they don't need manifest or CreateActCtx to make Messagebox better.
Why don't we make Messagebox much better?
About TaskDialog @Olina-Zhang @LeafShi1 can you verify for that we can change the background and foreground color ?
Is there a problem, if both Messagebox and TaskDialog have a more flexible look?
I will open a pull request for doing this if the team agrees otherwise I will close this issue as not acceptable api.
@Olina-Zhang @LeafShi1 can you verify for me that
TaskDialog
API is able to respond to OS dark mode?
Setting OS with dark mode color cannot respond to a series of TaskDialogs, although enabled DarkMode for application by Application.SetColorMode(SystemColorMode.Dark)
https://github.com/user-attachments/assets/c7b1b23c-004e-411b-bd41-8413bb35573b
The team's consensus is that we try to minimize touching the MessageBox
as much as possible. That said, we believe that DarkMode
support would be neat for it. Just not actual styling - that should go to the TaskDialog
.
@Olina-Zhang can you file a separate issue about TaskDialog
not responding to DarkMode
?
Filed an issue forTaskDialog
not responding to DarkMode
: https://github.com/dotnet/winforms/issues/12062.
Background and motivation
Improving MessageBox is something every developer wants, so they all resort to creating an alternative interface for it. You can find many examples on Github. This is because they cannot localize it or change its appearance, so this new API solves this problem.
API Proposal
API Usage
Alternative Designs
Risks
No response
Will this feature affect UI controls?
Will VS Designer need to support the feature? no Will this feature need to be localized or be localizable? yes