本文整理汇总了C#中TextView.SetBinding方法的典型用法代码示例。如果您正苦于以下问题:C# TextView.SetBinding方法的具体用法?C# TextView.SetBinding怎么用?C# TextView.SetBinding使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TextView
的用法示例。
在下文中一共展示了TextView.SetBinding方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: TextArea
/// <summary>
/// Creates a new TextArea instance.
/// </summary>
protected TextArea(TextView textView)
{
if (textView == null)
throw new ArgumentNullException("textView");
this.textView = textView;
this.Options = textView.Options;
textView.SetBinding(TextView.DocumentProperty, new Binding(DocumentProperty.Name) { Source = this });
textView.SetBinding(TextView.OptionsProperty, new Binding(OptionsProperty.Name) { Source = this });
textView.Services.AddService(typeof(TextArea), this);
leftMargins.Add(new LineNumberMargin { TextView = textView, TextArea = this } );
leftMargins.Add(new Line {
X1 = 0, Y1 = 0, X2 = 0, Y2 = 1,
StrokeDashArray = { 0, 2 },
Stretch = Stretch.Fill,
Stroke = Brushes.Gray,
StrokeThickness = 1,
StrokeDashCap = PenLineCap.Round,
Margin = new Thickness(2, 0, 2, 0)
});
textView.LineTransformers.Add(new SelectionColorizer(this));
textView.InsertLayer(new SelectionLayer(this), KnownLayer.Selection, LayerInsertionPosition.Replace);
caret = new Caret(this);
caret.PositionChanged += (sender, e) => RequestSelectionValidation();
this.DefaultInputHandler = new TextAreaDefaultInputHandler(this);
this.ActiveInputHandler = this.DefaultInputHandler;
}
示例2: TextArea
/// <summary>
/// Creates a new TextArea instance.
/// </summary>
protected TextArea(TextView textView)
{
if (textView == null)
throw new ArgumentNullException("textView");
this.textView = textView;
this.Options = textView.Options;
textView.SetBinding(TextView.DocumentProperty, new Binding(DocumentProperty.Name) { Source = this });
textView.SetBinding(TextView.OptionsProperty, new Binding(OptionsProperty.Name) { Source = this });
textView.Services.AddService(typeof(TextArea), this);
textView.LineTransformers.Add(new SelectionColorizer(this));
textView.InsertLayer(new SelectionLayer(this), KnownLayer.Selection, LayerInsertionPosition.Replace);
caret = new Caret(this);
caret.PositionChanged += (sender, e) => RequestSelectionValidation();
leftMargins.CollectionChanged += leftMargins_CollectionChanged;
this.DefaultInputHandler = new TextAreaDefaultInputHandler(this);
this.ActiveInputHandler = this.DefaultInputHandler;
this.FindOnPageBrush = new SolidColorBrush(Color.FromArgb(0xAF, 0xFF, 0x42, 0x4E));
this.FindOnPageBorder = new Pen(new SolidColorBrush(Color.FromArgb(0x9F, 0xFF, 0x42, 0x4E)), 2.0);
this.SelectionBrush = new SolidColorBrush(Color.FromArgb(0xAF, 0x2A, 0x45, 0x79));
this.SelectionBorder = new Pen(new SolidColorBrush(Color.FromArgb(0x9F, 0x2A, 0x45, 0x79)), 1.0);
}