Exemplo n.º 1
0
            protected override void OnMouseEnter(EventArgs e)
            {
                Background = new SolidBrush((GdiPresentation.Color)SystemColors.Highlight);

                var highlightText = (GdiPresentation.Color)SystemColors.HighlightText;

                _subject.ForeColor = highlightText;
                _subject.FontStyle = FontStyle.Bold | FontStyle.Underline;

                _message.ForeColor = highlightText;
                _created.ForeColor = highlightText;

                _close.Visibility = Visibility.Visible;
            }
Exemplo n.º 2
0
            public Item(NotificationsControl control, NotificationItem item)
            {
                _control = control;
                _item    = item;

                BorderThickness = new Thickness(4, 0, 0, 0);
                Background      = Brush.Transparent;
                Padding         = new Thickness(5);
                Cursor          = Cursor.Hand;

                switch (item.Priority)
                {
                case NiNotificationItemPriority.Informational:
                    BorderBrush = new SolidBrush((GdiPresentation.Color)WarningColor);
                    break;

                case NiNotificationItemPriority.Critical:
                    BorderBrush = new SolidBrush((GdiPresentation.Color)ErrorColor);
                    break;

                default:
                    BorderBrush = Brush.Transparent;
                    break;
                }

                var grid = new Grid
                {
                    ColumnDefinitions =
                    {
                        new ColumnDefinition(new GridLength(GridUnitType.Star, 1)),
                        new ColumnDefinition(GridLength.Auto)
                    },
                    RowDefinitions =
                    {
                        new RowDefinition(GridLength.Auto)
                    }
                };

                Content = grid;

                var information = new StackPanel
                {
                    Orientation = Orientation.Vertical
                };

                grid.Children.Add(information);

                _subject = new TextBlock
                {
                    FontStyle    = FontStyle.Bold,
                    TextTrimming = TextTrimming.CharacterEllipsis
                };
                information.Children.Add(_subject);

                _message = new TextBlock
                {
                    Wrap = true
                };
                Grid.SetRow(_message, 1);
                information.Children.Add(_message);

                _created = new TextBlock
                {
                    ForeColor    = (GdiPresentation.Color)SystemColors.GrayText,
                    TextTrimming = TextTrimming.CharacterEllipsis,
                    Margin       = new Thickness(0, 2, 0, 0)
                };
                Grid.SetColumnSpan(_created, 2);
                Grid.SetRow(_created, 2);
                information.Children.Add(_created);

                _close = new GdiPresentation.Image
                {
                    Margin            = new Thickness(3),
                    Bitmap            = NotificationClose,
                    Cursor            = Cursor.Arrow,
                    Visibility        = Visibility.Hidden,
                    Background        = Brush.Transparent,
                    VerticalAlignment = VerticalAlignment.Top
                };
                _close.MouseUp += _close_MouseUp;
                Grid.SetColumn(_close, 1);
                grid.Children.Add(_close);

                UpdateFromItem();
            }