public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService) { _textView = textView; _classifier = classifier.GetClassifier(textView.TextBuffer); _foregroundBrush = new SolidColorBrush((Color)FindResource(VsColors.CaptionTextKey)); _backgroundBrush = new SolidColorBrush((Color)FindResource(VsColors.ScrollBarBackgroundKey)); this.Background = _backgroundBrush; this.ClipToBounds = true; _lblEncoding = new TextControl("Encoding"); this.Children.Add(_lblEncoding); _lblContentType = new TextControl("Content type"); this.Children.Add(_lblContentType); _lblClassification = new TextControl("Classification"); this.Children.Add(_lblClassification); _lblSelection = new TextControl("Selection"); this.Children.Add(_lblSelection); UpdateClassificationLabel(); UpdateContentTypeLabel(); UpdateContentSelectionLabel(); if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc)) { _doc.FileActionOccurred += FileChangedOnDisk; UpdateEncodingLabel(_doc); } textView.Caret.PositionChanged += CaretPositionChanged; }
public BottomMargin(IWpfTextView textView, IClassifierAggregatorService classifier, ITextDocumentFactoryService documentService) { _textView = textView; _classifier = classifier.GetClassifier(textView.TextBuffer); SetResourceReference(BackgroundProperty, EnvironmentColors.ScrollBarBackgroundBrushKey); ClipToBounds = true; _lblEncoding = new TextControl("Encoding"); Children.Add(_lblEncoding); _lblContentType = new TextControl("Content type"); Children.Add(_lblContentType); _lblClassification = new TextControl("Classification"); Children.Add(_lblClassification); _lblSelection = new TextControl("Selection"); Children.Add(_lblSelection); UpdateClassificationLabel(); UpdateContentTypeLabel(); UpdateContentSelectionLabel(); if (documentService.TryGetTextDocument(textView.TextDataModel.DocumentBuffer, out _doc)) { _doc.FileActionOccurred += FileChangedOnDisk; UpdateEncodingLabel(_doc); } textView.Caret.PositionChanged += CaretPositionChanged; }