Пример #1
0
        private static UIElement GetNotificationContent(string text, Drawing drawingGroup)
        {
            var panel = new StackPanel
            {
                Orientation = Orientation.Vertical
            };

            var textBlock = new TextBlock
            {
                Text   = text,
                Margin = new Thickness(0, 0, 0, 5)
            };

            panel.Children.Add(textBlock);

            var gridCellControl = new GridCellControl
            {
                Background          = new SolidColorBrush(ColorParser.ParseHexColor("#fcfbfa")),
                GridLineBrush       = new SolidColorBrush(ColorParser.ParseHexColor("#dcdcdc")),
                VerticalAlignment   = VerticalAlignment.Stretch,
                HorizontalAlignment = HorizontalAlignment.Stretch,
                Child = new Image
                {
                    Source  = new DrawingImage(drawingGroup),
                    Stretch = Stretch.Uniform
                }
            };

            var binding = new Binding
            {
                Path           = new PropertyPath("ActualWidth"),
                RelativeSource = RelativeSource.Self
            };

            gridCellControl.SetBinding(FrameworkElement.HeightProperty, binding);
            panel.Children.Add(gridCellControl);

            return(panel);
        }