public bool TryGetImageMoniker(ImmutableArray<string> tags, out ImageMoniker imageMoniker)
        {
            this.AssertIsForeground();

            imageMoniker = GetImageMoniker(tags);
            return !imageMoniker.IsNullImage();
        }
        public bool TryGetImageMoniker(ImmutableArray <string> tags, out ImageMoniker imageMoniker)
        {
            this.AssertIsForeground();

            imageMoniker = GetImageMoniker(tags);
            return(!imageMoniker.IsNullImage());
        }
Beispiel #3
0
        public bool TryGetImageMoniker(ImmutableArray <string> tags, out ImageMoniker imageMoniker)
        {
            var glyph = tags.GetFirstGlyph();

            // We can't do the compositing of these glyphs at the editor layer.  So just map them
            // to the non-add versions.
            switch (glyph)
            {
            case Glyph.AddReference:
                glyph = Glyph.Reference;
                break;
            }

            imageMoniker = glyph.GetImageMoniker();
            return(!imageMoniker.IsNullImage());
        }
        public bool TryGetImageMoniker(ImmutableArray<string> tags, out ImageMoniker imageMoniker)
        {
            var glyph = tags.GetGlyph();

            // We can't do the compositing of these glyphs at the editor layer.  So just map them
            // to the non-add versions.
            switch (glyph)
            {
                case Glyph.AddReference:
                    glyph = Glyph.Reference;
                    break;
            }

            imageMoniker = glyph.GetImageMoniker();
            return !imageMoniker.IsNullImage();
        }
        /// <summary>
        /// Creates an element to display within the TableControl comprised of both an image and text string.
        /// </summary>
        internal static FrameworkElement CreateGridElement(
            ImageMoniker imageMoniker,
            string text,
            bool isBold
            )
        {
            var stackPanel = new StackPanel
            {
                Orientation         = Orientation.Horizontal,
                HorizontalAlignment = HorizontalAlignment.Stretch
            };

            var block = new TextBlock {
                VerticalAlignment = VerticalAlignment.Center
            };

            block.Inlines.Add(
                new Run(text)
            {
                FontWeight = isBold ? FontWeights.Bold : FontWeights.Normal
            }
                );

            if (!imageMoniker.IsNullImage())
            {
                // If we have an image and text, then create some space between them.
                block.Margin = new Thickness(5.0, 0.0, 0.0, 0.0);

                var image = new CrispImage
                {
                    VerticalAlignment = VerticalAlignment.Center,
                    Moniker           = imageMoniker,
                    Width             = 16.0,
                    Height            = 16.0
                };

                stackPanel.Children.Add(image);
            }

            // Always add the textblock last so it can follow the image.
            stackPanel.Children.Add(block);

            return(stackPanel);
        }