fixed a bug of GrowlWindow

This commit is contained in:
NaBian committed 2019-12-02 22:22:14 +08:00
1 parent 5099bfe393
commit 1e913c27f4
3 files changed
+12 -18

No files matched your search

@@ -800,7 +800,7 @@ namespace HandyControl.Controls
_timerClose?.Stop(); _timerClose?.Stop();
var transform = new TranslateTransform(); var transform = new TranslateTransform();
_gridMain.RenderTransform = transform; _gridMain.RenderTransform = transform;
var animation = AnimationHelper.CreateAnimation(MaxWidth); var animation = AnimationHelper.CreateAnimation(ActualWidth);
animation.Completed += (s, e) => animation.Completed += (s, e) =>
{ {
if (Parent is Panel panel) if (Parent is Panel panel)
@@ -3,24 +3,27 @@ using System.Windows.Controls;
namespace HandyControl.Controls namespace HandyControl.Controls
{ {
[TemplatePart(Name = ElementGrowPanel, Type = typeof(Panel))]
internal class GrowlWindow : Window internal class GrowlWindow : Window
{ {
private const string ElementGrowPanel = "PART_GrowPanel";
public Panel GrowlPanel { get; set; } public Panel GrowlPanel { get; set; }
public GrowlWindow() public GrowlWindow()
{ {
WindowStyle = WindowStyle.None; WindowStyle = WindowStyle.None;
AllowsTransparency = true; AllowsTransparency = true;
}
public override void OnApplyTemplate() GrowlPanel = new StackPanel
{ {
base.OnApplyTemplate(); VerticalAlignment = VerticalAlignment.Top,
Margin = new Thickness(0, 10, 10, 10)
};
GrowlPanel = GetTemplateChild(ElementGrowPanel) as Panel; Content = new ScrollViewer
{
VerticalScrollBarVisibility = ScrollBarVisibility.Hidden,
IsEnableInertia = true,
Content = GrowlPanel
};
} }
public void Init() public void Init()
@@ -19,15 +19,6 @@
<Setter Property="ShowActivated" Value="False"/> <Setter Property="ShowActivated" Value="False"/>
<Setter Property="ShowInTaskbar" Value="False"/> <Setter Property="ShowInTaskbar" Value="False"/>
<Setter Property="Topmost" Value="True"/> <Setter Property="Topmost" Value="True"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:GrowlWindow">
<controls:ScrollViewer VerticalScrollBarVisibility="Hidden" IsEnableInertia="True">
<StackPanel Name="PART_GrowPanel" VerticalAlignment="Top" Margin="0,10,10,10"/>
</controls:ScrollViewer>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style> </Style>
<Style TargetType="controls:Growl"> <Style TargetType="controls:Growl">