I styled my Tooltip using this lines of C# code:
Popup pp = new Popup();
ToolTipService.SetShowDuration(pp, 1000);
TextBlock tb = new TextBlock() { Text = errorMessage };
tb.Foreground = SystemColors.InfoTextBrush;
tb.Background = SystemColors.InfoBrush;
tb.TextWrapping = TextWrapping.Wrap;
tb.Padding = new Thickness(4, 0, 4, 0);
tb.TextAlignment = TextAlignment.Center;
Border b1 = new Border() { Child = tb };
pp.Child = b1;
b1.BorderThickness = new Thickness(1, 1, 1, 1);
b1.BorderBrush = SystemColors.ActiveBorderBrush;
pp.Height = 20;
pp.PlacementTarget = this;
pp.StaysOpen = false;
And when the Tooltip get rendered, it looks like this
Does anyone knows why's that line is showing? and how can I get rid of it?
CodePudding user response:
The rendering issue. Usually set UseLayoutRounding=true
solves the issue.
TextBlock tb = new TextBlock() { Text = errorMessage, UseLayoutRounding = true };