Пример #1
0
        public DAXEditor()
        {
            //DefaultStyleKeyProperty.OverrideMetadata(typeof(DAXEditor), new FrameworkPropertyMetadata(typeof(DAXEditor)));

            //SearchPanel.Install(this.TextArea);
            var brush = (SolidColorBrush)(new BrushConverter().ConvertFrom("#C8FFA55F")); //orange // grey FFE6E6E6

            HighlightBackgroundBrush        = brush;
            this.TextArea.SelectionChanged += TextEditor_TextArea_SelectionChanged;
            TextView textView = this.TextArea.TextView;

            // Add Bracket Highlighter
            _bracketRenderer = new BracketHighlightRenderer(textView);
            textView.BackgroundRenderers.Add(_bracketRenderer);
            //textView.LineTransformers.Add(_bracketRenderer);
            textView.Services.AddService(typeof(BracketHighlightRenderer), _bracketRenderer);

            // Add Syntax Error marker
            textMarkerService = new TextMarkerService(this);
            textView.BackgroundRenderers.Add(textMarkerService);
            textView.LineTransformers.Add(textMarkerService);
            textView.Services.AddService(typeof(TextMarkerService), textMarkerService);

            // add handlers for tooltip error display
            textView.MouseHover         += TextEditorMouseHover;
            textView.MouseHoverStopped  += TextEditorMouseHoverStopped;
            textView.VisualLinesChanged += VisualLinesChanged;

            //textView.PreviewKeyUp += TextArea_PreviewKeyUp;
            // add the stub Intellisense provider
            IntellisenseProvider = new IntellisenseProviderStub();

            this.DocumentChanged += DaxEditor_DocumentChanged;
            DataObject.AddPastingHandler(this, OnDataObjectPasting);
        }
        internal static void ApplyCustomizationsToRendering(BracketHighlightRenderer renderer, IEnumerable <Color> customizations)
        {
            renderer.UpdateColors(DefaultBackground, DefaultBorder);

            foreach (Color color in customizations)
            {
                //if (color.Name == BracketHighlight) {
                renderer.UpdateColors(color, color);
                //					renderer.UpdateColors(color.Background ?? Colors.Blue, color.Foreground ?? Colors.Blue);
                // 'break;' is necessary because more specific customizations come first in the list
                // (language-specific customizations are first, followed by 'all languages' customizations)
                break;
                //}
            }
        }