public EditorNavigationMargin(IWpfTextView wpfTextView, IEnumerable<IEditorNavigationSource> sources, IEditorNavigationTypeRegistryService editorNavigationTypeRegistryService)
        {
            Contract.Requires<ArgumentNullException>(wpfTextView != null, "wpfTextView");
            Contract.Requires<ArgumentNullException>(sources != null, "sources");
            Contract.Requires<ArgumentNullException>(editorNavigationTypeRegistryService != null, "editorNavigationTypeRegistryService");

            this._wpfTextView = wpfTextView;
            this._sources = sources;
            this._editorNavigationTypeRegistryService = editorNavigationTypeRegistryService;

            _navigationControls =
                this._sources
                .SelectMany(source => source.GetNavigationTypes())
                .Distinct()
                //.OrderBy(...)
                .Select(type => Tuple.Create(type, default(EditorNavigationComboBox)))
                .ToArray();

            if (this._navigationControls.Length == 0)
            {
                this._container =
                    new UniformGrid()
                    {
                        Visibility = Visibility.Collapsed
                    };

                return;
            }

            this._container = new UniformGrid()
            {
                Columns = _navigationControls.Length,
                Rows = 1
            };

            _navigationControls = Array.ConvertAll(_navigationControls,
                pair =>
                {
                    EditorNavigationComboBox comboBox =
                        new EditorNavigationComboBox()
                        {
                            Cursor = Cursors.Arrow,
                            ToolTip = new ToolTip()
                            {
                                Content = pair.Item1.Definition.DisplayName
                            }
                        };

                    comboBox.DropDownOpened += OnDropDownOpened;
                    comboBox.SelectionChanged += OnSelectionChanged;
                    return Tuple.Create(pair.Item1, comboBox);
                });

            foreach (var controlPair in _navigationControls)
            {
                this._container.Children.Add(controlPair.Item2);
            }

            this._wpfTextView.Caret.PositionChanged += OnCaretPositionChanged;
            foreach (var source in this._sources)
            {
                source.NavigationTargetsChanged += WeakEvents.AsWeak(OnNavigationTargetsChanged, eh => source.NavigationTargetsChanged -= eh);
                UpdateNavigationTargets(source);
            }

        }
        private bool ComboBoxFilter(IEditorNavigationType navigationType, EditorNavigationComboBox comboBox, IEditorNavigationTarget target)
        {
            if (navigationType == null || comboBox == null || target == null)
                return true;

            if (!navigationType.Definition.EnclosingTypes.Any())
                return true;

            IEditorNavigationTarget owner;
            if (!_owners.TryGetValue(target, out owner))
                return true;

            return _navigationControls.Select(i => i.Item2.SelectedItem).OfType<IEditorNavigationTarget>().Contains(owner);
        }