/// <summary> /// Initializes a new instance of the <see cref="AnnotationMargin"/> class for a given <paramref name="textView"/>. /// </summary> /// <param name="textView">The <see cref="IWpfTextView"/> to attach the margin to.</param> public AnnotationMargin(IWpfTextView textView, AnnotateMarginViewModel vm) { // Store the parameters _wpfTextView = textView; _vm = vm; // Create the WPF view _view = new AnnotateMarginView(_vm); _view.Width = 160; // Hook up to the layout changed event on the editor _wpfTextView.LayoutChanged += OnLayoutChanged; //this.Width = 100; //this.ClipToBounds = true; //this.Background = new SolidColorBrush ( Colors.Cornsilk ); // Add a green colored label that says "Hello AnnotationMargin" var label = new Label { Background = new SolidColorBrush(Colors.WhiteSmoke), Content = "Note", }; this.Children.Add(label); }
public AnnotateMarginViewModel GetModel(string tempFile) { if (_ViewModelMap.ContainsKey(tempFile)) { // If the editor pane is split into two independent parts, a second margin will be // generated. To handle this we need a separate ViewModel for each part of the split // window. var annParam = _ViewModelMap [tempFile]; var annView = new AnnotateMarginViewModel(annParam.Context); annView.Initialize(annParam.Origin, annParam.BlameResult, tempFile); return(annView); } else { return(null); } }
public AnnotateMarginView(AnnotateMarginViewModel vm) { InitializeComponent(); DataContext = vm; }