コード例 #1
0
        private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            LineOfCode      loc;
            MatchCollection matches = null;

            if (DataContext is LineOfCode)
            {
                loc = (LineOfCode)DataContext;
            }
            else if (DataContext is FaintLine)
            {
                loc = ((FaintLine)DataContext).Line;
            }
            else if (DataContext is MatchedLine)
            {
                MatchedLine ml = (MatchedLine)DataContext;
                loc     = ml.Line;
                matches = ml.Matches;
            }
            else
            {
                return;
            }
            CodeTextBlock.Inlines.Clear();
            SyntaxHighlighting.PrintWithVerySimpleSyntaxHighlighting(CodeTextBlock, loc.Text, matches);
        }
コード例 #2
0
        private void UserControl_DataContextChanged(object sender, DependencyPropertyChangedEventArgs e)
        {
            var text = DataContext as string;

            if (text == null)
            {
                return;
            }
            AttributeTextBlock.Inlines.Clear();
            SyntaxHighlighting.PrintWithVerySimpleSyntaxHighlighting(AttributeTextBlock, text, default(MatchCollection));
        }