diff --git a/src/Avalonia.Controls/ToolTip.cs b/src/Avalonia.Controls/ToolTip.cs
index 2f11746891..b458b15c64 100644
--- a/src/Avalonia.Controls/ToolTip.cs
+++ b/src/Avalonia.Controls/ToolTip.cs
@@ -204,13 +204,15 @@ namespace Avalonia.Controls
private static void IsOpenChanged(AvaloniaPropertyChangedEventArgs e)
{
var control = (Control)e.Sender;
+ var newValue = (bool)e.NewValue;
+ ToolTip toolTip;
- if ((bool)e.NewValue)
+ if (newValue)
{
var tip = GetTip(control);
if (tip == null) return;
- var toolTip = control.GetValue(ToolTipProperty);
+ toolTip = control.GetValue(ToolTipProperty);
if (toolTip == null || (tip != toolTip && tip != toolTip.Content))
{
toolTip?.Close();
@@ -223,9 +225,11 @@ namespace Avalonia.Controls
}
else
{
- var toolTip = control.GetValue(ToolTipProperty);
+ toolTip = control.GetValue(ToolTipProperty);
toolTip?.Close();
}
+
+ toolTip?.UpdatePseudoClasses(newValue);
}
private void Open(Control control)
@@ -238,6 +242,9 @@ namespace Avalonia.Controls
_popup.ConfigurePosition(control, GetPlacement(control),
new Point(GetHorizontalOffset(control), GetVerticalOffset(control)));
+
+ WindowManagerAddShadowHintChanged(_popup, false);
+
_popup.Show();
}
@@ -250,5 +257,18 @@ namespace Avalonia.Controls
_popup = null;
}
}
+
+ private void WindowManagerAddShadowHintChanged(IPopupHost host, bool hint)
+ {
+ if (host is PopupRoot pr)
+ {
+ pr.PlatformImpl.SetWindowManagerAddShadowHint(hint);
+ }
+ }
+
+ private void UpdatePseudoClasses(bool newValue)
+ {
+ PseudoClasses.Set(":open", newValue);
+ }
}
}
diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml
index 7a715bbde7..8233ecd02c 100644
--- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml
+++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseDark.xaml
@@ -31,6 +31,10 @@
#FF1D1D1D
#FF333333
+
+
+
+
2,2,2,2
@@ -312,5 +316,15 @@
+
+
+ 12
+ 1
+
+
+
+
+
+
diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml
index 5c6286a0bc..b3285bebf5 100644
--- a/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml
+++ b/src/Avalonia.Themes.Fluent/Accents/FluentBaseLight.xaml
@@ -31,6 +31,10 @@
#FFE6E6E6
#FFCCCCCC
+
+
+
+
2,2,2,2
@@ -313,5 +317,15 @@
+
+
+ 12
+ 1
+
+
+
+
+
+
diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml
index 7364c339f1..6412b2882e 100644
--- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml
+++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesDark.xaml
@@ -290,6 +290,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1
@@ -343,5 +370,16 @@
+
+
+ 12
+ 1
+
+
+
+
+
+
+ 8,5,8,7
diff --git a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml
index 15e157f573..65988f0e65 100644
--- a/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml
+++ b/src/Avalonia.Themes.Fluent/Accents/FluentControlResourcesLight.xaml
@@ -290,6 +290,33 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
1
@@ -343,5 +370,16 @@
+
+
+ 12
+ 1
+
+
+
+
+
+
+ 8,5,8,7
diff --git a/src/Avalonia.Themes.Fluent/Calendar.xaml b/src/Avalonia.Themes.Fluent/Calendar.xaml
index 6bbee4ef17..6ae334dbae 100644
--- a/src/Avalonia.Themes.Fluent/Calendar.xaml
+++ b/src/Avalonia.Themes.Fluent/Calendar.xaml
@@ -5,13 +5,14 @@
// All other rights reserved.
-->
-
+
-
\ No newline at end of file
+
diff --git a/src/Avalonia.Themes.Fluent/CalendarButton.xaml b/src/Avalonia.Themes.Fluent/CalendarButton.xaml
index 3314534b3b..87082ef21e 100644
--- a/src/Avalonia.Themes.Fluent/CalendarButton.xaml
+++ b/src/Avalonia.Themes.Fluent/CalendarButton.xaml
@@ -7,75 +7,115 @@
-
- -->
+
+
-
-
-
-
+
+
+
+
+
+
-
-
-
- -->
+
+
diff --git a/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml b/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml
index 2d79e62a75..ff72044c93 100644
--- a/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml
+++ b/src/Avalonia.Themes.Fluent/CalendarDayButton.xaml
@@ -7,110 +7,110 @@
-
-
-
-
+ -->
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
diff --git a/src/Avalonia.Themes.Fluent/CalendarItem.xaml b/src/Avalonia.Themes.Fluent/CalendarItem.xaml
index dfd89ed82f..df17da84dc 100644
--- a/src/Avalonia.Themes.Fluent/CalendarItem.xaml
+++ b/src/Avalonia.Themes.Fluent/CalendarItem.xaml
@@ -8,176 +8,127 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+ FontSize="12"/>
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
diff --git a/src/Avalonia.Themes.Fluent/ToolTip.xaml b/src/Avalonia.Themes.Fluent/ToolTip.xaml
index 1fc0202dd3..cf6f32f9bc 100644
--- a/src/Avalonia.Themes.Fluent/ToolTip.xaml
+++ b/src/Avalonia.Themes.Fluent/ToolTip.xaml
@@ -1,17 +1,78 @@
-
\ No newline at end of file
+
+
+
+
+ Hover Here
+
+
+
+
+
+ ToolTip
+ A control which pops up a hint when a control is hovered
+
+
+ ToolTip bottom placement
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/tests/Avalonia.Controls.UnitTests/ToolTipTests.cs b/tests/Avalonia.Controls.UnitTests/ToolTipTests.cs
index dc5b574db7..34b37e7635 100644
--- a/tests/Avalonia.Controls.UnitTests/ToolTipTests.cs
+++ b/tests/Avalonia.Controls.UnitTests/ToolTipTests.cs
@@ -102,5 +102,76 @@ namespace Avalonia.Controls.UnitTests
Assert.True(ToolTip.GetIsOpen(target));
}
}
+
+ [Fact]
+ public void Open_Class_Should_Not_Initially_Be_Added()
+ {
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var toolTip = new ToolTip();
+ var window = new Window();
+
+ var decorator = new Decorator()
+ {
+ [ToolTip.TipProperty] = toolTip
+ };
+
+ window.Content = decorator;
+
+ window.ApplyTemplate();
+ window.Presenter.ApplyTemplate();
+
+ Assert.Empty(toolTip.Classes);
+ }
+ }
+
+ [Fact]
+ public void Setting_IsOpen_Should_Add_Open_Class()
+ {
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var toolTip = new ToolTip();
+ var window = new Window();
+
+ var decorator = new Decorator()
+ {
+ [ToolTip.TipProperty] = toolTip
+ };
+
+ window.Content = decorator;
+
+ window.ApplyTemplate();
+ window.Presenter.ApplyTemplate();
+
+ ToolTip.SetIsOpen(decorator, true);
+
+ Assert.Equal(new[] { ":open" }, toolTip.Classes);
+ }
+ }
+
+ [Fact]
+ public void Clearing_IsOpen_Should_Remove_Open_Class()
+ {
+ using (UnitTestApplication.Start(TestServices.StyledWindow))
+ {
+ var toolTip = new ToolTip();
+ var window = new Window();
+
+ var decorator = new Decorator()
+ {
+ [ToolTip.TipProperty] = toolTip
+ };
+
+ window.Content = decorator;
+
+ window.ApplyTemplate();
+ window.Presenter.ApplyTemplate();
+
+ ToolTip.SetIsOpen(decorator, true);
+ ToolTip.SetIsOpen(decorator, false);
+
+ Assert.Empty(toolTip.Classes);
+ }
+ }
}
}