diff --git a/ICSharpCode.AvalonEdit/Search/SearchPanel.cs b/ICSharpCode.AvalonEdit/Search/SearchPanel.cs
index d8e37c07..0b20c8b4 100644
--- a/ICSharpCode.AvalonEdit/Search/SearchPanel.cs
+++ b/ICSharpCode.AvalonEdit/Search/SearchPanel.cs
@@ -120,6 +120,57 @@ public Brush MarkerBrush {
set { SetValue(MarkerBrushProperty, value); }
}
+ private static void MarkerBrushChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is SearchPanel panel) {
+ panel.renderer.MarkerBrush = (Brush)e.NewValue;
+ }
+ }
+
+ ///
+ /// Dependency property for .
+ ///
+ public static readonly DependencyProperty MarkerPenProperty =
+ DependencyProperty.Register("MarkerPen", typeof(Pen), typeof(SearchPanel),
+ new PropertyMetadata(null, MarkerPenChangedCallback));
+
+ ///
+ /// Gets/sets the Pen used for marking search results in the TextView.
+ ///
+ public Pen MarkerPen {
+ get { return (Pen)GetValue(MarkerPenProperty); }
+ set { SetValue(MarkerPenProperty, value); }
+ }
+
+ private static void MarkerPenChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is SearchPanel panel) {
+ panel.renderer.MarkerPen = (Pen)e.NewValue;
+ }
+ }
+
+ ///
+ /// Dependency property for .
+ ///
+ public static readonly DependencyProperty MarkerCornerRadiusProperty =
+ DependencyProperty.Register("MarkerCornerRadius", typeof(double), typeof(SearchPanel),
+ new PropertyMetadata(3.0, MarkerCornerRadiusChangedCallback));
+
+ ///
+ /// Gets/sets the corner-radius used for marking search results in the TextView.
+ ///
+ public double MarkerCornerRadius {
+ get { return (double)GetValue(MarkerCornerRadiusProperty); }
+ set { SetValue(MarkerCornerRadiusProperty, value); }
+ }
+
+ private static void MarkerCornerRadiusChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
+ {
+ if (d is SearchPanel panel) {
+ panel.renderer.MarkerCornerRadius = (double)e.NewValue;
+ }
+ }
+
///
/// Dependency property for .
///
@@ -136,14 +187,6 @@ public Localization Localization {
}
#endregion
- static void MarkerBrushChangedCallback(DependencyObject d, DependencyPropertyChangedEventArgs e)
- {
- SearchPanel panel = d as SearchPanel;
- if (panel != null) {
- panel.renderer.MarkerBrush = (Brush)e.NewValue;
- }
- }
-
static SearchPanel()
{
DefaultStyleKeyProperty.OverrideMetadata(typeof(SearchPanel), new FrameworkPropertyMetadata(typeof(SearchPanel)));
diff --git a/ICSharpCode.AvalonEdit/Search/SearchResultBackgroundRenderer.cs b/ICSharpCode.AvalonEdit/Search/SearchResultBackgroundRenderer.cs
index 21750cdc..4cd3d6b9 100644
--- a/ICSharpCode.AvalonEdit/Search/SearchResultBackgroundRenderer.cs
+++ b/ICSharpCode.AvalonEdit/Search/SearchResultBackgroundRenderer.cs
@@ -42,20 +42,14 @@ public KnownLayer Layer {
public SearchResultBackgroundRenderer()
{
- markerBrush = Brushes.LightGreen;
- markerPen = new Pen(markerBrush, 1);
+ MarkerBrush = Brushes.LightGreen;
+ MarkerPen = null;
+ MarkerCornerRadius = 3.0;
}
- Brush markerBrush;
- Pen markerPen;
-
- public Brush MarkerBrush {
- get { return markerBrush; }
- set {
- this.markerBrush = value;
- markerPen = new Pen(markerBrush, 1);
- }
- }
+ public Brush MarkerBrush { get; set; }
+ public Pen MarkerPen { get; set; }
+ public double MarkerCornerRadius { get; set; }
public void Draw(TextView textView, DrawingContext drawingContext)
{
@@ -74,11 +68,16 @@ public void Draw(TextView textView, DrawingContext drawingContext)
int viewStart = visualLines.First().FirstDocumentLine.Offset;
int viewEnd = visualLines.Last().LastDocumentLine.EndOffset;
+ Brush markerBrush = MarkerBrush;
+ Pen markerPen = MarkerPen;
+ double markerCornerRadius = MarkerCornerRadius;
+ double markerPenThickness = markerPen != null ? markerPen.Thickness : 0;
+
foreach (SearchResult result in currentResults.FindOverlappingSegments(viewStart, viewEnd - viewStart)) {
BackgroundGeometryBuilder geoBuilder = new BackgroundGeometryBuilder();
geoBuilder.AlignToWholePixels = true;
- geoBuilder.BorderThickness = markerPen != null ? markerPen.Thickness : 0;
- geoBuilder.CornerRadius = 3;
+ geoBuilder.BorderThickness = markerPenThickness;
+ geoBuilder.CornerRadius = markerCornerRadius;
geoBuilder.AddSegment(textView, result);
Geometry geometry = geoBuilder.CreateGeometry();
if (geometry != null) {