开发者

Applying ResourceDictionary Theme to a Simple MessageBox

Does anyone know this one?

I currently have an application with a bunch of user controls. They are all themed with the "Dark Expressions" theme. Anyways, when I call on a "MessageBox" using the common code:

MessageBox.Show("message", "title", MessageBoxButtons.YesNo);

It is using the generic windows theme. Is it possible to create a themed message box very easily? I have tried expending the MessageBox type with a user control, but I keep on getting the error "Cannot derive form sealed type "System.Windows.MessageBox"

The theme is defined using the ResourceDictionary way:

开发者_JS百科

    <ResourceDictionary.MergedDictionaries>
        <ResourceDictionary Source="./Resources/Themes/ExpressionDark.xaml" />
    </ResourceDictionary.MergedDictionaries>

</ResourceDictionary>

So the gist of it is, I'd like my message box to look the same as my application; the cool and somber "dark expressions" theme. Right now it looks out of place with the mildly amusing Win7 theme.


There are plenty of custom message boxes available on the net like this either you can use those after applying your theme to it or you can simply create your own not by deriving from the MessageBox class but by creating a custom control.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜