protected virtual FrameworkElement CreateHeaderCore(string icon, IEnumerable<string> overlays, string header, bool isPublic) { var panel = new StackPanel { Orientation = Orientation.Horizontal }; var icons = new Grid(); var mainIcon = DefaultImages.AssemblyBrowser.GetDefaultImage(icon); mainIcon.Width = 16; mainIcon.Height = 16; icons.Children.Add(mainIcon); if (overlays != null) { foreach (var overlay in overlays) icons.Children.Add(DefaultImages.AssemblyBrowser.GetDefaultImage(overlay)); } panel.Children.Add(icons); var caption = new TextBlock { Text = header, Margin = new Thickness(5, 0, 0, 0), FontWeight = FontWeights.Normal }; if (!isPublic) caption.FontStyle = FontStyles.Italic; panel.Children.Add(caption); panel.MouseRightButtonDown += (s, e) => e.Handled = true; panel.MouseRightButtonUp += (s, e) => { IsSelected = true; var menu = CreateContextMenu(); if (menu == null || menu.Items.Count == 0) return; GeneralTransform gt = panel.TransformToVisual(Application.Current.RootVisual as UIElement); Point offset = gt.Transform(new Point(0, 0)); menu.HorizontalOffset = offset.X + e.GetPosition(panel).X; menu.VerticalOffset = offset.Y + e.GetPosition(panel).Y; menu.IsOpen = true; }; return panel; }