Skip to content

Commit aeea6ee

Browse files
committed
Update Tracker default style
1 parent d7bc1a1 commit aeea6ee

File tree

2 files changed

+11
-13
lines changed

2 files changed

+11
-13
lines changed

ScreenShots/normal-distributions.png

1.75 KB
Loading

Source/OxyPlot.Maui.Skia/Tracker/TrackerControl.xaml.cs

Lines changed: 11 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,8 +11,8 @@ public TrackerControl()
1111
{
1212
InitializeComponent();
1313

14-
Background = new SolidColorBrush(Color.FromArgb("#E0666666"));
15-
LineStroke = new SolidColorBrush(Color.FromArgb("#80FFFFFF"));
14+
Background = new SolidColorBrush(Color.FromArgb("#E0FFFFA0"));
15+
LineStroke = new SolidColorBrush(Color.FromArgb("#80000000"));
1616

1717
ControlTemplate = (ControlTemplate)Resources["TrackerControlTemplate"];
1818
IsClippedToBounds = false;
@@ -21,7 +21,6 @@ public TrackerControl()
2121
public static Func<View> DefaultTrackerTemplateContentProvider = () =>
2222
{
2323
var label = new Label();
24-
label.TextColor = Colors.White;
2524
label.Margin = 7;
2625
label.LineBreakMode = LineBreakMode.WordWrap;
2726
label.SetBinding(Label.TextProperty, ".");
@@ -82,10 +81,10 @@ public TrackerControl()
8281
nameof(CornerRadius), typeof(double), typeof(TrackerControl), 0.0);
8382

8483
public static readonly BindableProperty BorderThicknessProperty = BindableProperty.Create(
85-
nameof(BorderThickness), typeof(int), typeof(TrackerControl), 0);
84+
nameof(BorderThickness), typeof(int), typeof(TrackerControl), 1);
8685

8786
public static readonly BindableProperty BorderBrushProperty = BindableProperty.Create(
88-
nameof(BorderBrush), typeof(Brush), typeof(TrackerControl), Brush.White);
87+
nameof(BorderBrush), typeof(Brush), typeof(TrackerControl), Brush.Black);
8988

9089
/// <summary>
9190
/// Identifies the <see cref="Distance" /> dependency property.
@@ -373,11 +372,7 @@ private void UpdatePositionAndBorder()
373372

374373
var canvasWidth = parent.Width;
375374
var canvasHeight = parent.Height;
376-
var contentSize = content.DesiredSize;
377-
if (contentSize.IsZero)
378-
{
379-
contentSize = content.Measure(canvasWidth, canvasHeight).Request;
380-
}
375+
var contentSize = content.Measure(canvasWidth, canvasHeight).Request;
381376

382377
var contentWidth = contentSize.Width;
383378
var contentHeight = contentSize.Height;
@@ -444,7 +439,7 @@ private void UpdatePositionAndBorder()
444439

445440
content.Margin = margin;
446441

447-
var contentContainerSize = new Size(contentSize.Width + margin.Left + margin.Right, contentSize.Height + margin.Top + margin.Bottom);
442+
var contentContainerSize = new Size(contentSize.Width + margin.HorizontalThickness, contentSize.Height + margin.VerticalThickness);
448443

449444
contentContainer.TranslationX = dx * contentContainerSize.Width;
450445
contentContainer.TranslationY = dy * contentContainerSize.Height;
@@ -542,8 +537,6 @@ private Geometry CreatePointerBorderGeometry(
542537
var m = Distance;
543538
margin = new Thickness();
544539

545-
// PathFigureCollectionConverter.ParseStringToPathFigureCollection();
546-
547540
if (ha == HorizontalAlignment.Center && va == VerticalAlignment.Bottom)
548541
{
549542
double x0 = 0;
@@ -700,6 +693,11 @@ private Geometry CreatePointerBorderGeometry(
700693
};
701694
}
702695

696+
if (BorderThickness > 0)
697+
{
698+
margin += BorderThickness;
699+
}
700+
703701
if (points == null)
704702
{
705703
return null;

0 commit comments

Comments
 (0)