Browse Source

fix animations

feature/test-branch^2
Dan Walmsley 6 years ago
parent
commit
5a09fd63bc
  1. 10
      samples/ControlCatalog/ViewModels/MainWindowViewModel.cs
  2. 3
      src/Avalonia.Controls/Chrome/TitleBar.cs
  3. 7
      src/Avalonia.Themes.Fluent/TitleBar.xaml

10
samples/ControlCatalog/ViewModels/MainWindowViewModel.cs

@ -68,22 +68,24 @@ namespace ControlCatalog.ViewModels
this.WhenAnyValue(x => x.SystemChromeButtonsEnabled, x=>x.ManagedChromeButtonsEnabled, x => x.SystemTitleBarEnabled)
.Subscribe(x =>
{
ChromeHints = ExtendClientAreaChromeHints.NoChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
var hints = ExtendClientAreaChromeHints.NoChrome | ExtendClientAreaChromeHints.OSXThickTitleBar;
if(x.Item1)
{
ChromeHints |= ExtendClientAreaChromeHints.SystemChromeButtons;
hints |= ExtendClientAreaChromeHints.SystemChromeButtons;
}
if(x.Item2)
{
ChromeHints |= ExtendClientAreaChromeHints.ManagedChromeButtons;
hints |= ExtendClientAreaChromeHints.ManagedChromeButtons;
}
if(x.Item3)
{
ChromeHints |= ExtendClientAreaChromeHints.SystemTitleBar;
hints |= ExtendClientAreaChromeHints.SystemTitleBar;
}
ChromeHints = hints;
});
SystemTitleBarEnabled = true;

3
src/Avalonia.Controls/Chrome/TitleBar.cs

@ -2,6 +2,7 @@
using System.Reactive.Disposables;
using Avalonia.Controls.Primitives;
using Avalonia.Input;
using Avalonia.LogicalTree;
using Avalonia.Media;
namespace Avalonia.Controls.Chrome
@ -63,6 +64,8 @@ namespace Avalonia.Controls.Chrome
PseudoClasses.Set(":fullscreen", x == WindowState.FullScreen);
})
};
_captionButtons?.Attach(_hostWindow);
}
}

7
src/Avalonia.Themes.Fluent/TitleBar.xaml

@ -30,15 +30,13 @@
<Setter Property="IsHitTestVisible" Value="True" />
</Style>
<Style Selector="TitleBar:fullscreen /template/ Panel#PART_MouseTracker">
<Setter Property="Background" Value="Transparent" />
</Style>
<Style Selector="TitleBar:fullscreen:not(:pointerover) /template/ Panel#PART_Container">
<Style.Animations>
<Animation Duration="0:0:.5" Easing="SineEaseInOut">
<Animation Duration="0:0:.5" Easing="SineEaseInOut" FillMode="Both">
<KeyFrame Cue="0%">
<Setter Property="TranslateTransform.Y" Value="0"/>
</KeyFrame>
@ -47,12 +45,11 @@
</KeyFrame>
</Animation>
</Style.Animations>
<Setter Property="TranslateTransform.Y" Value="-30" />
</Style>
<Style Selector="TitleBar:fullscreen:pointerover /template/ Panel#PART_Container">
<Style.Animations>
<Animation Duration="0:0:.5" Easing="SineEaseInOut">
<Animation Duration="0:0:.5" Easing="SineEaseInOut" FillMode="Both">
<KeyFrame Cue="0%">
<Setter Property="TranslateTransform.Y" Value="-30"/>
</KeyFrame>

Loading…
Cancel
Save