开发者

WPF: message box with checkbox added

In WPF I am looking for a "do not show again" checkbox on my messagebox popup.

Does anyone know where I can get such a control or maybe how to copy the style of the regular WPF mes开发者_开发问答sagebox so I can create my own?

Thanks


Take a look at the Dialog Boxes Overview. The overview covers Message Boxes, Common Dialog Boxes, and Custom Dialog Boxes. In your case you'll want to create a simple Custom Dialog Box that includes a message, a checkbox, and however many buttons you need.

Basically you need to define a new code-behind file that includes your TextBlock, CheckBox, and Buttons in a panel object, and you need to extend Window. In your code-behind file you implement any necessary logic to implement the user's choice, and you return this result to the object containing the custom dialog box.

Make sure to pay special attention to this line of code when creating your custom dialog box:

// Open the dialog box modally 
messageBox.ShowDialog();

The call to ShowDialog() will ensure that the user must take action against your dialog box before moving on to other parts of your application.


I think , you may have to create by yourself and it is really easy in the WPF


You could just use a dialog box. An easy way to do it would be to keep a variable in the project settings that would be updated on the popup close() event. So then you would just have to verify the value in the project settings before showing the popup.

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜