Example #1
0
        /// <summary>
        /// Initializes a new instance of the <see cref="IniEditorMargin"/> class for a given <paramref name="textView"/>.
        /// </summary>
        /// <param name="textView">The <see cref="IWpfTextView"/> to attach the margin to.</param>
        public IniEditorMargin(IWpfTextView textView)
        {
            var docPath = textView.TextDataModel.DocumentBuffer.Properties.GetProperty<Microsoft.VisualStudio.Text.ITextDocument>(typeof(Microsoft.VisualStudio.Text.ITextDocument))?.FilePath;
            var vm = new OutlineViewModel(docPath, textView.TextSnapshot.GetText());

            _textView = textView;
            _outlineControl = new ParallaxOutline(vm);
            _viewContainer = (_textView as FrameworkElement).Parent as FrameworkElement;

            _viewContainer.LayoutUpdated += OnParentLayoutChanged;
            textView.TextBuffer.Changed += OnTextBufferChanged;

            ClipToBounds = true;
            Children.Add(_outlineControl);

            OnParentLayoutChanged(null, EventArgs.Empty);
        }
        public ParallaxOutline(OutlineViewModel vm)
        {
            InitializeComponent();

            this.DataContext = vm;
        }