Inheritance: System.Windows.Controls.ItemsControl
示例#1
0
        private static NotificationBox CreateNotificationBox(string title, string message, NotificationAction[] commands, Visibility showAgainVisibility = Visibility.Collapsed, bool showAgain = true, string showAgainText = null, string uniqueKey = null)
        {
            var notificationBox = new NotificationBox
            {
                Width = NotificationWidth,
                Height = NotificationHeight,
                Title = title,
                Message = message,
                ShowAgainOption = showAgain,
                ShowAgainText = showAgainText,
                ShowAgainVisibility = showAgainVisibility,
                UniqueKey = uniqueKey
            };

            foreach (var action in commands)
            {
                var notificationBoxItem = new NotificationBoxItem
                {
                    Content = action.Content,
                    Command = action.Command,
                    ContentTemplate = TryFindTemplate(action.ContentTemplateKey)
                };

                notificationBox.Items.Add(notificationBoxItem);
            }

            return notificationBox;
        }