-
Notifications
You must be signed in to change notification settings - Fork 0
DialogBox
Artem Kirgizov edited this page May 31, 2021
·
2 revisions
The DialogBox is a way to notify the user about an event occurring in the application, or to request permission for an action. Unlike the standard MessageDialog provided in WPF, this implementation contains many design improvements, as well as the variability of the information contained within the dialog.
It is assumed that the configuration of the dialog box will come from code. Configuration example (* Standard value is the default value if no option was specified):
Toolkit.UI.WPF.Controls.DialogBox box = new Toolkit.UI.WPF.Controls.DialogBox()
{
// Positioning the title within the top block vertically. Default value is Center
HeaderVerticalAlignment = VerticalAlignment.Center,
// Positioning the title within the top block horizontally. Default value is Left
HeaderHorizontalAlignment = HorizontalAlignment.Left,
// Whole window background color. Default value is White
Background = Brushes.White,
// The content of the header can contain any control. Default font size is 28
Header = new TextBlock() { Text = "The header!" },
// Header content color. Default value is Black
HeaderForeground = Brushes.Black,
// Padding of the header from edges. Default value is 0
HeaderMargin = new Thickness(20, 0, 20, 0),
// The main content of the message. Can contain any control
Content = new TextBlock() { Text = "It's content!", FontSize = 20 },
// Main content color. Default value is Black
ContentForeground = Brushes.Red,
// Padding content from edges. Default value is 0
ContentMargin = new Thickness(20),
// The color of the dialog box border. Default value is Black
// Attention, the frame is implemented as a symmetrical shadow on all sides.
BorderBrush = Brushes.YellowGreen.Color,
// The color of all buttons located on the dialog box. Default value is White
ButtonsBackground = Brushes.Black,
// The color of the contents of the buttons located on the dialog box. Default value is Black
ButtonsForeground = Brushes.BlueViolet,
// A variation of the buttons to be placed on the dialog box.
// Implemented as flags so can be configured based on preference.
// However, there are predefined options such as DialogBoxButtons.PrimaryAndClose and DialogBoxButtons.All.
// Default value is DialogBoxButtons.PrimaryAndClose
ButtonsConfiguration = DialogBoxButtons.Close | DialogBoxButtons.Primary,
// A way of putting content on a button. Likewise for the Close and Secondary buttons.
// Default value for primary is "Apply";
// Default value for secondary is "Secondary";
// Default value for primary is "Close"
PrimaryButtonContent = "Apply",
// Font size for buttons. Default value is 12
ButtonsFontSize = 15,
// The font family used for the buttons. Default value is "Segoe UI"
ButtonsFontFamily = new FontFamily("Arial")
};
// Show the window and wait for the exit from the dialog.
// The result is a DialogBoxResult enum, and can be Primary, Secondary, or Close
var result = box.ShowDialog();
// Simple display of a dialog box without waiting for the user's decision.
box.Show();
- And also some others, which can be found in the source code.