private void OpenToolTip([NotNull] object sender, [NotNull] ToolTipEventArgs e)
        {
            Debug.ArgumentNotNull(sender, nameof(sender));
            Debug.ArgumentNotNull(e, nameof(e));

            ToolTip = ToolTipBuilder.BuildToolTip(this);
        }
        private void OpenToolTip([NotNull] object sender, [NotNull] ToolTipEventArgs e)
        {
            Diagnostics.Debug.ArgumentNotNull(sender, nameof(sender));
            Diagnostics.Debug.ArgumentNotNull(e, nameof(e));

            ToolTip = ToolTipBuilder.BuildToolTip(Item);
        }
        private void LoadRenderingGallery([NotNull] LayoutDesigner layoutDesigner, [NotNull] InRibbonGallery gallery)
        {
            Debug.ArgumentNotNull(layoutDesigner, nameof(layoutDesigner));
            Debug.ArgumentNotNull(gallery, nameof(gallery));

            Site.RequestCompleted completed = delegate(string response)
            {
                var root = response.ToXElement();
                if (root == null)
                {
                    return;
                }

                var items      = root.Elements().Select(element => ItemHeader.Parse(layoutDesigner.DatabaseUri, element)).Where(e => MatchesSpeakCoreVersion(e, layoutDesigner)).ToList();
                var renderings = new List <RenderingButton>();

                foreach (var item in items.OrderBy(i => i.ParentName).ThenBy(i => i.Name))
                {
                    var button = new RenderingButton
                    {
                        Label   = item.Name,
                        Icon    = item.Icon,
                        Tag     = item,
                        ToolTip = ToolTipBuilder.BuildToolTip(item)
                    };

                    button.PreviewMouseUp += (sender, args) => { AddRenderingFromRibbon(layoutDesigner, sender, button); };

                    renderings.Add(button);
                }

                renderings = renderings.OrderBy(i => i.Label).ToList();

                gallery.ItemsSource = renderings;
            };

            layoutDesigner.DatabaseUri.Site.Execute("Layouts.GetRenderings", completed, layoutDesigner.DatabaseUri.DatabaseName.ToString());
        }