Exemple #1
0
 public MarkdownList(MarkdownBar bar)
 {
     Style     = SharedDictionaryManager.VirtualList.Get <Style>(typeof(VirtualList));
     Container = bar.ListContainer;
     Header    = new StackPanel {
         Margin   = WpfHelper.MenuItemMargin,
         Children =
         {
             new Separator  {
                 Tag = new ThemedMenuText(R.CMD_SearchTitles)
             },
             new StackPanel {
                 Orientation = Orientation.Horizontal,
                 Children    =
                 {
                     ThemeHelper.GetImage(IconIds.Search).WrapMargin(WpfHelper.GlyphMargin),
                     (_FinderBox = new ThemedTextBox{
                         MinWidth = 150
                     }),
                     new ThemedButton(IconIds.ClearFilter,                                  R.CMD_ClearFilter, ClearFilter)
                 }
             },
         }
     };
     Footer = new TextBlock {
         Margin = WpfHelper.MenuItemMargin
     }
     .ReferenceProperty(TextBlock.ForegroundProperty, Microsoft.VisualStudio.PlatformUI.EnvironmentColors.SystemGrayTextBrushKey)
     .Append(ThemeHelper.GetImage(IconIds.LineOfCode))
     .Append(bar.View.TextSnapshot.LineCount);
     _FinderBox.TextChanged += SearchCriteriaChanged;
     _FinderBox.SetOnVisibleSelectAll();
     _Bar = bar;
 }
Exemple #2
0
            void AddNaviBar(object sender, RoutedEventArgs e)
            {
                _View.VisualElement.Loaded -= AddNaviBar;

                var view    = sender as FrameworkElement;
                var naviBar = view
                              ?.GetParent <Border>(b => b.Name == "PART_ContentPanel")
                              ?.GetFirstVisualChild <Border>(b => b.Name == "DropDownBarMargin");

                if (naviBar == null)
                {
                    var naviBarHolder = view.GetParent <Panel>(b => b.GetType().Name == "WpfMultiViewHost");
                    if (naviBarHolder != null)
                    {
                        var b = new MarkdownBar(_View, _TextSearch);
                        DockPanel.SetDock(b, Dock.Top);
                        if (naviBarHolder.Children.Count == 1)
                        {
                            naviBarHolder.Children.Insert(0, b);
                        }
                        else
                        {
                            var c = naviBarHolder.Children[0] as ContentControl;
                            if (c != null && c.Content == null)
                            {
                                c.Content = b;
                            }
                        }
                    }
                    return;
                }
                var dropDown1 = naviBar.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown1");
                var dropDown2 = naviBar.GetFirstVisualChild <ComboBox>(c => c.Name == "DropDown2");

                if (dropDown1 == null || dropDown2 == null)
                {
                    return;
                }
                var container = dropDown1.GetParent <Grid>();

                if (container == null)
                {
                    return;
                }
                var bar = new CSharpBar(_View)
                {
                    MinWidth = 200
                };

                bar.SetCurrentValue(Grid.ColumnProperty, 2);
                bar.SetCurrentValue(Grid.ColumnSpanProperty, 3);
                container.Children.Add(bar);
                dropDown1.Visibility = Visibility.Hidden;
                dropDown2.Visibility = Visibility.Hidden;
                naviBar.Unloaded    += ResurrectNaviBar_OnUnloaded;
            }