Merge branch 'master' into enhance-input-element

This commit is contained in:
NaBian committed 2019-03-24 16:59:18 +08:00
commit 784600990e
23 files changed
+470 -189

No files matched your search

+2 -2
View File
@@ -15,12 +15,12 @@ namespace HandyControl.Controls
{
var collection = Interaction.GetBehaviors(panel);
var oldBehavior = GetTempFluidMoveBehavior(panel);
collection.Remove(oldBehavior);
collection.ItemRemoved(oldBehavior);
panel.SetCurrentValue(TempFluidMoveBehaviorProperty, DependencyProperty.UnsetValue);
if (e.NewValue is FluidMoveBehavior behavior)
{
collection.Add(behavior);
collection.ItemAdded(behavior);
SetTempFluidMoveBehavior(panel, behavior);
}
}
+60 -1
View File
@@ -7,7 +7,7 @@ using HandyControl.Interactivity;
namespace HandyControl.Controls
{
public class SearchBar : TextBox
public class SearchBar : TextBox, ICommandSource
{
public SearchBar()
{
@@ -51,6 +51,16 @@ namespace HandyControl.Controls
{
Info = Text
});
if (Command == null) return;
if (Command is RoutedCommand command)
{
command.Execute(CommandParameter, CommandTarget);
}
else
{
Command.Execute(CommandParameter);
}
}
/// <summary>
@@ -67,5 +77,54 @@ namespace HandyControl.Controls
get => (bool)GetValue(IsRealTimeProperty);
set => SetValue(IsRealTimeProperty, value);
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
"Command", typeof(ICommand), typeof(SearchBar), new PropertyMetadata(default(ICommand), OnCommandChanged));
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (SearchBar)d;
if (e.OldValue is ICommand oldCommand)
{
oldCommand.CanExecuteChanged -= ctl.CanExecuteChanged;
}
if (e.NewValue is ICommand newCommand)
{
newCommand.CanExecuteChanged += ctl.CanExecuteChanged;
}
}
public ICommand Command
{
get => (ICommand) GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register(
"CommandParameter", typeof(object), typeof(SearchBar), new PropertyMetadata(default(object)));
public object CommandParameter
{
get => GetValue(CommandParameterProperty);
set => SetValue(CommandParameterProperty, value);
}
public static readonly DependencyProperty CommandTargetProperty = DependencyProperty.Register(
"CommandTarget", typeof(IInputElement), typeof(SearchBar), new PropertyMetadata(default(IInputElement)));
public IInputElement CommandTarget
{
get => (IInputElement) GetValue(CommandTargetProperty);
set => SetValue(CommandTargetProperty, value);
}
private void CanExecuteChanged(object sender, EventArgs e)
{
if (Command == null) return;
IsEnabled = Command is RoutedCommand command
? command.CanExecute(CommandParameter, CommandTarget)
: Command.CanExecute(CommandParameter);
}
}
}
+27 -21
View File
@@ -4,7 +4,6 @@ using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Animation;
using System.Windows.Threading;
using HandyControl.Data;
using HandyControl.Interactivity;
@@ -43,11 +42,6 @@ namespace HandyControl.Controls
private int _waitTime = 6;
/// <summary>
/// 消息容器
/// </summary>
public static Panel GrowlPanel { get; set; }
/// <summary>
/// 计数
/// </summary>
@@ -65,14 +59,21 @@ namespace HandyControl.Controls
CommandBindings.Add(new CommandBinding(ControlCommands.Close, ButtonClose_OnClick));
CommandBindings.Add(new CommandBinding(ControlCommands.Cancel, ButtonCancel_OnClick));
CommandBindings.Add(new CommandBinding(ControlCommands.Confirm, ButtonOk_OnClick));
MouseEnter += Growl_MouseEnter;
MouseLeave += Growl_MouseLeave;
}
private void Growl_MouseLeave(object sender, MouseEventArgs e) => _buttonClose.Collapse();
protected override void OnMouseEnter(MouseEventArgs e)
{
base.OnMouseEnter(e);
private void Growl_MouseEnter(object sender, MouseEventArgs e) => _buttonClose.Show(_showCloseButton);
_buttonClose.Show(_showCloseButton);
}
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
_buttonClose.Collapse();
}
public override void OnApplyTemplate()
{
@@ -93,6 +94,11 @@ namespace HandyControl.Controls
private Func<bool, bool> ActionBeforeClose { get; set; }
/// <summary>
/// 消息容器
/// </summary>
public static Panel GrowlPanel { get; set; }
internal static readonly DependencyProperty CancelStrProperty = DependencyProperty.Register(
"CancelStr", typeof(string), typeof(Growl), new PropertyMetadata(default(string)));
@@ -120,7 +126,7 @@ namespace HandyControl.Controls
public static readonly DependencyProperty GrowlParentProperty = DependencyProperty.RegisterAttached(
"GrowlParent", typeof(bool), typeof(Growl), new PropertyMetadata(ValueBoxes.FalseBox, (o, args) =>
{
if (o is Panel panel)
if ((bool)args.NewValue && o is Panel panel)
{
SetGrowlPanel(panel);
}
@@ -226,14 +232,8 @@ namespace HandyControl.Controls
menuItem
}
};
var behavior = new FluidMoveBehavior
{
AppliesTo = FluidMoveScope.Children,
Duration = new Duration(TimeSpan.FromMilliseconds(400)),
EaseY = new PowerEase()
};
var collection = Interaction.GetBehaviors(GrowlPanel);
collection.Add(behavior);
PanelElement.SetFluidMoveBehavior(GrowlPanel, ResourceHelper.GetResource<FluidMoveBehavior>(ResourceToken.BehaviorXY400));
}
private void Update()
@@ -451,7 +451,13 @@ namespace HandyControl.Controls
var transform = new TranslateTransform();
_gridMain.RenderTransform = transform;
var animation = AnimationHelper.CreateAnimation(MaxWidth);
animation.Completed += delegate { GrowlPanel.Children.Remove(this); };
animation.Completed += (s, e) =>
{
if (Parent is Panel panel)
{
panel.Children.Remove(this);
}
};
transform.BeginAnimation(TranslateTransform.XProperty, animation);
}
+84 -38
View File
@@ -1,14 +1,12 @@
using System;
using System.ComponentModel;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Shapes;
using HandyControl.Data;
using HandyControl.Interactivity;
using HandyControl.Tools;
using HandyControl.Tools.Extension;
namespace HandyControl.Controls
{
@@ -17,14 +15,6 @@ namespace HandyControl.Controls
/// </summary>
public sealed class MessageBox : Window
{
#region Constants
private const string ElementImage = "PART_Image";
private const string ElementMessage = "PART_Message";
#endregion Constants
private MessageBoxResult _messageBoxResult = MessageBoxResult.Cancel;
private bool _showOk;
@@ -35,13 +25,41 @@ namespace HandyControl.Controls
private bool _showNo;
private string _message;
public static readonly DependencyProperty MessageProperty = DependencyProperty.Register(
"Message", typeof(string), typeof(MessageBox), new PropertyMetadata(default(string)));
private Geometry _image;
public string Message
{
get => (string) GetValue(MessageProperty);
set => SetValue(MessageProperty, value);
}
private Brush _imageBrush;
public static readonly DependencyProperty ImageProperty = DependencyProperty.Register(
"Image", typeof(Geometry), typeof(MessageBox), new PropertyMetadata(default(Geometry)));
private bool _showImage;
public Geometry Image
{
get => (Geometry) GetValue(ImageProperty);
set => SetValue(ImageProperty, value);
}
public static readonly DependencyProperty ImageBrushProperty = DependencyProperty.Register(
"ImageBrush", typeof(Brush), typeof(MessageBox), new PropertyMetadata(default(Brush)));
public Brush ImageBrush
{
get => (Brush) GetValue(ImageBrushProperty);
set => SetValue(ImageBrushProperty, value);
}
public static readonly DependencyProperty ShowImageProperty = DependencyProperty.Register(
"ShowImage", typeof(bool), typeof(MessageBox), new PropertyMetadata(ValueBoxes.FalseBox));
public bool ShowImage
{
get => (bool) GetValue(ShowImageProperty);
set => SetValue(ShowImageProperty, value);
}
private MessageBox()
{
@@ -67,20 +85,48 @@ namespace HandyControl.Controls
}, (s, e) => e.CanExecute = _showNo));
}
protected override void OnSourceInitialized(EventArgs e)
protected override void OnPreviewKeyDown(KeyEventArgs e)
{
base.OnSourceInitialized(e);
base.OnPreviewKeyDown(e);
if (LogicalTreeHelper.FindLogicalNode(this, ElementMessage) is TextBlock message) message.Text = _message;
if (_showImage)
if (e.KeyboardDevice.Modifiers == ModifierKeys.Control && e.Key == Key.C)
{
if (LogicalTreeHelper.FindLogicalNode(this, ElementImage) is Path image)
var builder = new StringBuilder();
var line = new string('-', 27);
builder.Append(line);
builder.Append(Environment.NewLine);
builder.Append(Title);
builder.Append(Environment.NewLine);
builder.Append(line);
builder.Append(Environment.NewLine);
builder.Append(Message);
builder.Append(Environment.NewLine);
builder.Append(line);
builder.Append(Environment.NewLine);
if (_showOk)
{
image.Data = _image;
image.Fill = _imageBrush;
image.Show();
builder.Append(Properties.Langs.Lang.Confirm);
builder.Append(" ");
}
if (_showYes)
{
builder.Append(Properties.Langs.Lang.Yes);
builder.Append(" ");
}
if (_showNo)
{
builder.Append(Properties.Langs.Lang.No);
builder.Append(" ");
}
if (_showCancel)
{
builder.Append(Properties.Langs.Lang.Cancel);
builder.Append(" ");
}
builder.Append(Environment.NewLine);
builder.Append(line);
builder.Append(Environment.NewLine);
Clipboard.SetText(builder.ToString());
}
}
@@ -96,9 +142,9 @@ namespace HandyControl.Controls
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
messageBox._showImage = true;
messageBox._image = ResourceHelper.GetResource<Geometry>(ResourceToken.SuccessGeometry);
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.SuccessGeometry);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.SuccessBrush);
messageBox.ShowDialog();
});
@@ -174,9 +220,9 @@ namespace HandyControl.Controls
{
messageBox = CreateMessageBox(null, messageBoxText, caption, MessageBoxButton.OK, MessageBoxImage.None, MessageBoxResult.OK);
SetButtonStatus(messageBox, MessageBoxButton.OK);
messageBox._showImage = true;
messageBox._image = ResourceHelper.GetResource<Geometry>(ResourceToken.FatalGeometry);
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(ResourceToken.FatalGeometry);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(ResourceToken.PrimaryTextBrush);
messageBox.ShowDialog();
});
@@ -217,9 +263,9 @@ namespace HandyControl.Controls
if (!string.IsNullOrEmpty(info.IconKey))
{
messageBox._showImage = true;
messageBox._image = ResourceHelper.GetResource<Geometry>(info.IconKey);
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(info.IconKey);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(info.IconBrushKey);
}
messageBox.Style = info.Style;
@@ -293,9 +339,9 @@ namespace HandyControl.Controls
return new MessageBox
{
_message = messageBoxText,
Message = messageBoxText,
Owner = ownerWindow,
WindowStartupLocation = ownerIsNull ? WindowStartupLocation.CenterScreen : WindowStartupLocation.CenterOwner,
WindowStartupLocation = WindowStartupLocation.CenterScreen,
ShowTitle = true,
Title = caption ?? string.Empty,
Topmost = ownerIsNull,
@@ -352,9 +398,9 @@ namespace HandyControl.Controls
}
if (string.IsNullOrEmpty(iconKey)) return;
messageBox._showImage = true;
messageBox._image = ResourceHelper.GetResource<Geometry>(iconKey);
messageBox._imageBrush = ResourceHelper.GetResource<Brush>(iconBrushKey);
messageBox.ShowImage = true;
messageBox.Image = ResourceHelper.GetResource<Geometry>(iconKey);
messageBox.ImageBrush = ResourceHelper.GetResource<Brush>(iconBrushKey);
}
private static bool IsValidMessageBoxButton(MessageBoxButton value)
+35 -58
View File
@@ -1,11 +1,9 @@
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Input;
using System.Windows.Media;
using HandyControl.Data;
using HandyControl.Tools;
using HandyControl.Tools.Extension;
#if netle40
using Microsoft.Windows.Shell;
@@ -81,14 +79,14 @@ namespace HandyControl.Controls
private bool _isFullScreen;
private Thickness _actualBorderThickness;
private UIElement _nonClientArea;
private bool _showNonClientArea = true;
private double _tempNonClientAreaHeight;
private Thickness _tempThickness;
private WindowState _tempWindowState;
private WindowStyle _tempWindowStyle;
@@ -106,31 +104,7 @@ namespace HandyControl.Controls
new Binding(NonClientAreaHeightProperty.Name) {Source = this});
WindowChrome.SetWindowChrome(this, chrome);
Loaded += delegate
{
_tempThickness = BorderThickness;
if (WindowState == WindowState.Maximized)
{
BorderThickness = new Thickness();
}
CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand,
(s, e) => WindowState = WindowState.Minimized));
CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand,
(s, e) => WindowState = WindowState.Maximized));
CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand,
(s, e) => WindowState = WindowState.Normal));
CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (s, e) => Close()));
CommandBindings.Add(new CommandBinding(SystemCommands.ShowSystemMenuCommand, ShowSystemMenu));
_tempNonClientAreaHeight = NonClientAreaHeight;
_tempWindowState = WindowState;
_tempWindowStyle = WindowStyle;
_tempResizeMode = ResizeMode;
SwitchIsFullScreen(_isFullScreen);
SwitchShowNonClientArea(_showNonClientArea);
};
Loaded += (s, e) => OnLoaded(e);
}
public Brush CloseButtonBackground
@@ -317,15 +291,34 @@ namespace HandyControl.Controls
}
else if (WindowState == WindowState.Normal)
{
BorderThickness = _tempThickness;
BorderThickness = _actualBorderThickness;
}
}
public override void OnApplyTemplate()
protected void OnLoaded(RoutedEventArgs args)
{
base.OnApplyTemplate();
_actualBorderThickness = BorderThickness;
if (WindowState == WindowState.Maximized)
{
BorderThickness = new Thickness();
}
_nonClientArea = GetTemplateChild(ElementNonClientArea) as UIElement;
CommandBindings.Add(new CommandBinding(SystemCommands.MinimizeWindowCommand,
(s, e) => WindowState = WindowState.Minimized));
CommandBindings.Add(new CommandBinding(SystemCommands.MaximizeWindowCommand,
(s, e) => WindowState = WindowState.Maximized));
CommandBindings.Add(new CommandBinding(SystemCommands.RestoreWindowCommand,
(s, e) => WindowState = WindowState.Normal));
CommandBindings.Add(new CommandBinding(SystemCommands.CloseWindowCommand, (s, e) => Close()));
CommandBindings.Add(new CommandBinding(SystemCommands.ShowSystemMenuCommand, ShowSystemMenu));
_tempNonClientAreaHeight = NonClientAreaHeight;
_tempWindowState = WindowState;
_tempWindowStyle = WindowStyle;
_tempResizeMode = ResizeMode;
SwitchIsFullScreen(_isFullScreen);
SwitchShowNonClientArea(_showNonClientArea);
if (SizeToContent != SizeToContent.WidthAndHeight)
return;
@@ -334,11 +327,18 @@ namespace HandyControl.Controls
Dispatcher.BeginInvoke(new Action(() => { SizeToContent = SizeToContent.WidthAndHeight; }));
}
public override void OnApplyTemplate()
{
base.OnApplyTemplate();
_nonClientArea = GetTemplateChild(ElementNonClientArea) as UIElement;
}
private void ShowSystemMenu(object sender, ExecutedRoutedEventArgs e)
{
var point = WindowState == WindowState.Maximized
? new Point(0, 28)
: new Point(Left, Top + 28);
? new Point(0, NonClientAreaHeight)
: new Point(Left, Top + NonClientAreaHeight);
SystemCommands.ShowSystemMenu(this, point);
}
@@ -348,28 +348,5 @@ namespace HandyControl.Controls
if (SizeToContent == SizeToContent.WidthAndHeight)
InvalidateMeasure();
}
/// <summary>
/// 获取自定义窗口
/// </summary>
/// <returns></returns>
public static Window GetCustomWindow(FrameworkElement content)
{
var window = new Window
{
Style = ResourceHelper.GetResource<Style>(ResourceToken.WindowWin10),
Content = content
};
window.Loaded += (s, e) =>
{
window.Width = window.BorderThickness.Left + window.BorderThickness.Right + content.Width;
if (!(window.Template.FindName("GridMenu", window) is Grid nemuArea))
throw new NullReferenceException("can not find GridMenu in template");
window.Height = window.BorderThickness.Top + window.BorderThickness.Bottom + content.Height +
nemuArea.ActualHeight;
};
return window;
}
}
}
+1
View File
@@ -64,5 +64,6 @@
internal const string TabItemCapsuleVerticalLast = nameof(TabItemCapsuleVerticalLast);
internal const string BehaviorXY400 = nameof(BehaviorXY400);
}
}
@@ -22,14 +22,14 @@ namespace HandyControl.Interactivity
internal override void ItemAdded(Behavior item)
{
if (AssociatedObject == null)
if (item == null || AssociatedObject == null)
return;
item.Attach(AssociatedObject);
}
internal override void ItemRemoved(Behavior item)
{
if (((IAttachedObject) item).AssociatedObject == null)
if (((IAttachedObject) item)?.AssociatedObject == null)
return;
item.Detach();
}
+98 -22
View File
@@ -17,30 +17,106 @@
<Setter Property="BorderThickness" Value="1"/>
<Setter Property="ResizeMode" Value="NoResize"/>
<Setter Property="SizeToContent" Value="WidthAndHeight"/>
<Setter Property="Content">
<Setter Property="Template">
<Setter.Value>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Path x:Name="PART_Image" HorizontalAlignment="Center" Visibility="Collapsed" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="20,32,0,0" Width="30" Height="30" Stretch="Uniform"/>
<ScrollViewer Grid.Column="1" Grid.Row="0">
<TextBlock Margin="10,39,10,10" x:Name="PART_Message" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</ScrollViewer>
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Style="{StaticResource ButtonPrimary}"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Yes" Content="{x:Static langs:Lang.Yes}" Margin="5,0" Style="{StaticResource ButtonPrimary}"/>
</StackPanel>
</Grid>
<ControlTemplate TargetType="controls:MessageBox">
<Border SnapsToDevicePixels="True" BorderThickness="{TemplateBinding BorderThickness}" BorderBrush="{TemplateBinding BorderBrush}" Background="{TemplateBinding Background}">
<Grid Margin="{TemplateBinding Padding}">
<Grid.RowDefinitions>
<RowDefinition Height="Auto"/>
<RowDefinition/>
</Grid.RowDefinitions>
<Grid Background="{TemplateBinding NonClientAreaBackground}" Name="PART_NonClientArea" TextElement.Foreground="{TemplateBinding NonClientAreaForeground}">
<Grid.ColumnDefinitions>
<ColumnDefinition/>
<ColumnDefinition Width="Auto"/>
</Grid.ColumnDefinitions>
<StackPanel WindowChrome.IsHitTestVisibleInChrome="True" UseLayoutRounding="True" VerticalAlignment="Top" Grid.Column="1" HorizontalAlignment="Right" Orientation="Horizontal">
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MinimizeWindowCommand" IsTabStop="False" Name="ButtonMin" Height="29" Style="{StaticResource ButtonIcon}" Width="45" controls:IconElement.Geometry="{StaticResource WindowMinGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.MaximizeWindowCommand" IsTabStop="False" Name="ButtonMax" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowMaxGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding OtherButtonBackground}" Foreground="{TemplateBinding OtherButtonForeground}" Command="SystemCommands.RestoreWindowCommand" IsTabStop="False" Name="ButtonRestore" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource WindowRestoreGeometry}" BorderThickness="1,0,1,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
<Button Background="{TemplateBinding CloseButtonBackground}" Foreground="{TemplateBinding CloseButtonForeground}" Command="SystemCommands.CloseWindowCommand" IsTabStop="False" Name="ButtonClose" Height="29" Style="{StaticResource ButtonIcon}" Width="46" controls:IconElement.Geometry="{StaticResource CloseGeometry}" BorderThickness="1,0,0,0" controls:IconElement.Width="10" controls:IconElement.Height="10"/>
</StackPanel>
<Grid Grid.Column="0">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Image Name="Icon" Margin="10,0,0,0" Source="{TemplateBinding Icon}" VerticalAlignment="Center" Width="16" Height="16"/>
<TextBlock Name="Title" Grid.Column="1" Text="{TemplateBinding Title}" Padding="10,0,0,0" VerticalAlignment="Center"/>
<ContentPresenter WindowChrome.IsHitTestVisibleInChrome="True" Grid.Column="2" x:Name="ContentPresenterMain" Content="{TemplateBinding NonClientAreaContent}"/>
</Grid>
</Grid>
<Grid Grid.Row="1">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Path Data="{TemplateBinding Image}" Fill="{TemplateBinding ImageBrush}" HorizontalAlignment="Center" Visibility="{TemplateBinding ShowImage,Converter={StaticResource Boolean2VisibilityConverter}}" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="20,32,0,0" Width="30" Height="30" Stretch="Uniform"/>
<ScrollViewer Grid.Column="1" Grid.Row="0">
<TextBlock Margin="10,39,10,10" Text="{TemplateBinding Message}" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</ScrollViewer>
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Style="{StaticResource ButtonPrimary}"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Yes" Content="{x:Static langs:Lang.Yes}" Margin="5,0" Style="{StaticResource ButtonPrimary}"/>
</StackPanel>
</Grid>
</Grid>
</Border>
<ControlTemplate.Triggers>
<Trigger Property="IsActive" Value="False">
<Setter Property="Opacity" Value=".8" TargetName="ContentPresenterMain"/>
</Trigger>
<Trigger Property="Icon" Value="{x:Null}">
<Setter Property="Visibility" Value="Collapsed" TargetName="Icon"/>
</Trigger>
<Trigger Property="WindowState" Value="Maximized">
<Setter Property="Padding" Value="8"/>
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonMax"/>
<Setter Property="Visibility" Value="Visible" TargetName="ButtonRestore"/>
</Trigger>
<Trigger Property="WindowState" Value="Normal">
<Setter Property="Visibility" Value="Visible" TargetName="ButtonMax"/>
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonRestore"/>
</Trigger>
<Trigger Property="ResizeMode" Value="NoResize">
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonMin"/>
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonMax"/>
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonRestore"/>
</Trigger>
<Trigger Property="ResizeMode" Value="CanMinimize">
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonMax"/>
<Setter Property="Visibility" Value="Collapsed" TargetName="ButtonRestore"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonClose">
<Setter Property="Background" TargetName="ButtonClose" Value="{Binding CloseButtonHoverBackground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Setter Property="Foreground" TargetName="ButtonClose" Value="{Binding CloseButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonMax">
<Setter Property="Background" TargetName="ButtonMax" Value="{Binding OtherButtonHoverBackground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Setter Property="Foreground" TargetName="ButtonMax" Value="{Binding OtherButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonRestore">
<Setter Property="Background" TargetName="ButtonRestore" Value="{Binding OtherButtonHoverBackground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Setter Property="Foreground" TargetName="ButtonRestore" Value="{Binding OtherButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</Trigger>
<Trigger Property="IsMouseOver" Value="True" SourceName="ButtonMin">
<Setter Property="Background" TargetName="ButtonMin" Value="{Binding OtherButtonHoverBackground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
<Setter Property="Foreground" TargetName="ButtonMin" Value="{Binding OtherButtonHoverForeground,RelativeSource={RelativeSource Mode=TemplatedParent}}"/>
</Trigger>
<Trigger Property="ShowTitle" Value="False">
<Setter Property="Visibility" Value="Collapsed" TargetName="Title"/>
</Trigger>
</ControlTemplate.Triggers>
</ControlTemplate>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
+8 -7
View File
@@ -46,25 +46,26 @@
</Setter>
</Style>
<Style x:Key="WindowDefault" BasedOn="{x:Null}" TargetType="Window">
<Style x:Key="WindowDefault" TargetType="Window">
<Setter Property="Background" Value="{DynamicResource BackgroundBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
</Style>
<Style x:Key="WindowWin10" BasedOn="{x:Null}" TargetType="controls:Window">
<Style x:Key="WindowWin10" TargetType="controls:Window">
<Setter Property="Background" Value="{DynamicResource RegionBrush}"/>
<Setter Property="Foreground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="BorderBrush" Value="{DynamicResource ReverseTextBrush}"/>
<Setter Property="UseLayoutRounding" Value="True"/>
<Setter Property="NonClientAreaBackground" Value="White"/>
<Setter Property="NonClientAreaForeground" Value="{DynamicResource ReverseTextBrush}"/>
<Setter Property="NonClientAreaBackground" Value="{DynamicResource RegionBrush}"/>
<Setter Property="NonClientAreaForeground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="CloseButtonBackground" Value="Transparent"/>
<Setter Property="CloseButtonForeground" Value="{DynamicResource ReverseTextBrush}"/>
<Setter Property="CloseButtonForeground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="CloseButtonHoverBackground" Value="#e81123"/>
<Setter Property="CloseButtonHoverForeground" Value="White"/>
<Setter Property="OtherButtonBackground" Value="Transparent"/>
<Setter Property="OtherButtonForeground" Value="{DynamicResource ReverseTextBrush}"/>
<Setter Property="OtherButtonForeground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="OtherButtonHoverBackground" Value="#e5e5e5"/>
<Setter Property="OtherButtonHoverForeground" Value="{DynamicResource ReverseTextBrush}"/>
<Setter Property="OtherButtonHoverForeground" Value="{DynamicResource PrimaryTextBrush}"/>
<Setter Property="Template">
<Setter.Value>
<ControlTemplate TargetType="controls:Window">
+8
View File
@@ -359,6 +359,7 @@
<Compile Include="ViewModel\Common\ComboBoxDemoViewModel.cs" />
<Compile Include="ViewModel\Controls\CoverViewModel.cs" />
<Compile Include="ViewModel\Controls\DialogDemoViewModel.cs" />
<Compile Include="ViewModel\Controls\SearchBarDemoViewModel.cs" />
<Compile Include="ViewModel\DemoViewModelBase!1.cs" />
<Compile Include="ViewModel\Main\ContributorsViewModel.cs" />
<Compile Include="ViewModel\Controls\GrowlDemoViewModel.cs" />
@@ -380,6 +381,9 @@
<Compile Include="Window\CustomNonClientAreaWindow.xaml.cs">
<DependentUpon>CustomNonClientAreaWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Window\GrowlDemoWindow.xaml.cs">
<DependentUpon>GrowlDemoWindow.xaml</DependentUpon>
</Compile>
<Compile Include="Window\NoNonClientAreaDragableWindow.xaml.cs">
<DependentUpon>NoNonClientAreaDragableWindow.xaml</DependentUpon>
</Compile>
@@ -763,6 +767,10 @@
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window\GrowlDemoWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
</Page>
<Page Include="Window\NoNonClientAreaDragableWindow.xaml">
<SubType>Designer</SubType>
<Generator>MSBuild:Compile</Generator>
+1 -1
View File
@@ -33,7 +33,7 @@
<userControl:MainContent Grid.Column="1"/>
<GridSplitter Grid.Column="1" HorizontalAlignment="Left" Width="4" Background="Transparent" BorderThickness="1,0,0,0" BorderBrush="{DynamicResource BorderBrush}"/>
<controls:ScrollViewer Grid.Column="1" VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsEnableInertia="True" IsPenetrating="True">
<StackPanel controls:Growl.GrowlParent="True" VerticalAlignment="Top" Margin="0,10,10,10"/>
<StackPanel Name="GrowlPanel" VerticalAlignment="Top" Margin="0,10,10,10"/>
</controls:ScrollViewer>
</Grid>
</controls:BlurWindow>
+18 -1
View File
@@ -1,4 +1,7 @@
namespace HandyControlDemo
using System;
using HandyControl.Controls;
namespace HandyControlDemo
{
public partial class MainWindow
{
@@ -6,5 +9,19 @@
{
InitializeComponent();
}
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
Growl.SetGrowlParent(GrowlPanel, true);
}
protected override void OnDeactivated(EventArgs e)
{
base.OnDeactivated(e);
Growl.SetGrowlParent(GrowlPanel, false);
}
}
}
+18
View File
@@ -519,6 +519,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 消息通知示例 的本地化字符串。
/// </summary>
public static string GrowlDemo {
get {
return ResourceManager.GetString("GrowlDemo", resourceCulture);
}
}
/// <summary>
/// 查找类似 连接失败,请检查网络! 的本地化字符串。
/// </summary>
@@ -672,6 +681,15 @@ namespace HandyControlDemo.Properties.Langs {
}
}
/// <summary>
/// 查找类似 新建窗口 的本地化字符串。
/// </summary>
public static string NewWindow {
get {
return ResourceManager.GetString("NewWindow", resourceCulture);
}
}
/// <summary>
/// 查找类似 下一步 的本地化字符串。
/// </summary>
@@ -522,4 +522,10 @@
<data name="PleaseWait" xml:space="preserve">
<value>Please wait...</value>
</data>
<data name="GrowlDemo" xml:space="preserve">
<value>Growl demo</value>
</data>
<data name="NewWindow" xml:space="preserve">
<value>New window</value>
</data>
</root>
@@ -522,4 +522,10 @@
<data name="PleaseWait" xml:space="preserve">
<value>请稍后...</value>
</data>
<data name="GrowlDemo" xml:space="preserve">
<value>消息通知示例</value>
</data>
<data name="NewWindow" xml:space="preserve">
<value>新建窗口</value>
</data>
</root>
@@ -1,8 +1,7 @@
<ResourceDictionary xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControl.Properties.Langs;assembly=HandyControl">
xmlns:interactivity="clr-namespace:HandyControl.Interactivity;assembly=HandyControl">
<ResourceDictionary.MergedDictionaries>
<ResourceDictionary Source="../Basic/Geometries.xaml"/>
@@ -98,30 +97,6 @@
<Setter Property="OtherButtonHoverForeground" Value="White"/>
<Setter Property="NonClientAreaForeground" Value="White"/>
<Setter Property="CloseButtonForeground" Value="White"/>
<Setter Property="Content">
<Setter.Value>
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto"/>
<ColumnDefinition/>
</Grid.ColumnDefinitions>
<Grid.RowDefinitions>
<RowDefinition/>
<RowDefinition Height="Auto"/>
</Grid.RowDefinitions>
<Path x:Name="PART_Image" HorizontalAlignment="Center" Visibility="Collapsed" Grid.Row="0" Grid.Column="0" VerticalAlignment="Top" Margin="20,32,0,0" Width="30" Height="30" Stretch="Uniform"/>
<ScrollViewer Grid.Column="1" Grid.Row="0">
<TextBlock Margin="10,39,10,10" x:Name="PART_Message" TextWrapping="Wrap" HorizontalAlignment="Left" VerticalAlignment="Top"/>
</ScrollViewer>
<StackPanel Grid.Column="0" Grid.ColumnSpan="2" Grid.Row="1" Margin="0,10,0,16" Orientation="Horizontal" Background="{DynamicResource RegionBrush}" HorizontalAlignment="Center">
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.Cancel" Content="{x:Static langs:Lang.Cancel}" Margin="5,0"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Confirm" Content="{x:Static langs:Lang.Confirm}" Margin="5,0" Background="#262e2f" Style="{StaticResource ButtonPrimary}"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsCancel="True" MinWidth="88" Command="interactivity:ControlCommands.No" Content="{x:Static langs:Lang.No}" Margin="5,0"/>
<Button Visibility="{Binding IsEnabled,RelativeSource={RelativeSource Self},Converter={StaticResource Boolean2VisibilityConverter}}" IsDefault="True" MinWidth="88" Command="interactivity:ControlCommands.Yes" Content="{x:Static langs:Lang.Yes}" Margin="5,0" Background="#262e2f" Style="{StaticResource ButtonPrimary}"/>
</StackPanel>
</Grid>
</Setter.Value>
</Setter>
</Style>
</ResourceDictionary>
@@ -6,14 +6,17 @@
DataContext="{Binding GrowlDemo,Source={StaticResource Locator}}"
Background="{DynamicResource RegionBrush}">
<controls:TransitioningContentControl>
<WrapPanel Margin="32" VerticalAlignment="Center">
<Button Command="{Binding InfoCmd}" Content="{x:Static langs:Lang.Info}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
<Button Command="{Binding SuccessCmd}" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
<Button Command="{Binding WarningCmd}" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"/>
<Button Command="{Binding ErrorCmd}" Content="{x:Static langs:Lang.Error}" Margin="5" Style="{StaticResource ButtonDanger}"/>
<Button Command="{Binding AskCmd}" Content="{x:Static langs:Lang.Ask}" Margin="5" Background="BlueViolet" Foreground="White"/>
<Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/>
<Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
</WrapPanel>
<StackPanel Margin="32">
<WrapPanel VerticalAlignment="Center">
<Button Command="{Binding InfoCmd}" Content="{x:Static langs:Lang.Info}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
<Button Command="{Binding SuccessCmd}" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
<Button Command="{Binding WarningCmd}" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"/>
<Button Command="{Binding ErrorCmd}" Content="{x:Static langs:Lang.Error}" Margin="5" Style="{StaticResource ButtonDanger}"/>
<Button Command="{Binding AskCmd}" Content="{x:Static langs:Lang.Ask}" Margin="5" Background="BlueViolet" Foreground="White"/>
<Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/>
<Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
</WrapPanel>
<Button Command="{Binding NewWindowCmd}" Content="{x:Static langs:Lang.NewWindow}" Margin="0,5,0,0" HorizontalAlignment="Left"/>
</StackPanel>
</controls:TransitioningContentControl>
</UserControl>
@@ -3,11 +3,12 @@
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding SearchBarDemo,Source={StaticResource Locator}}"
Background="{DynamicResource RegionBrush}">
<controls:TransitioningContentControl>
<StackPanel Margin="32" Orientation="Horizontal">
<StackPanel>
<controls:SearchBar/>
<controls:SearchBar Command="{Binding SearchCmd}" CommandParameter="{Binding Text,RelativeSource={RelativeSource Self}}"/>
<controls:SearchBar Margin="0,32,0,0" IsEnabled="False"/>
<controls:SearchBar controls:InfoElement.Title="{x:Static langs:Lang.TitleDemoStr1}" Margin="0,32,0,0" Style="{StaticResource SearchBarExtend}"/>
@@ -2,6 +2,7 @@
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls;
using HandyControl.Data;
using HandyControlDemo.Window;
namespace HandyControlDemo.ViewModel
{
@@ -44,5 +45,8 @@ namespace HandyControlDemo.ViewModel
public RelayCommand ClearCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(Growl.Clear)).Value;
public RelayCommand NewWindowCmd => new Lazy<RelayCommand>(() =>
new RelayCommand(() => new GrowlDemoWindow().Show())).Value;
}
}
@@ -0,0 +1,18 @@
using System;
using GalaSoft.MvvmLight;
using GalaSoft.MvvmLight.Command;
using HandyControl.Controls;
namespace HandyControlDemo.ViewModel
{
public class SearchBarDemoViewModel : ViewModelBase
{
public RelayCommand<string> SearchCmd => new Lazy<RelayCommand<string>>(() =>
new RelayCommand<string>(Search)).Value;
private void Search(string key)
{
Growl.Info(key);
}
}
}
@@ -25,6 +25,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register<ChatBoxViewModel>();
SimpleIoc.Default.Register<CoverViewModel>();
SimpleIoc.Default.Register<DialogDemoViewModel>();
SimpleIoc.Default.Register<SearchBarDemoViewModel>();
}
public static ViewModelLocator Instance => new Lazy<ViewModelLocator>(() =>
@@ -54,6 +55,8 @@ namespace HandyControlDemo.ViewModel
public DialogDemoViewModel DialogDemo => ServiceLocator.Current.GetInstance<DialogDemoViewModel>();
public SearchBarDemoViewModel SearchBarDemo => ServiceLocator.Current.GetInstance<SearchBarDemoViewModel>();
#endregion
}
}
@@ -0,0 +1,29 @@
<Window x:Class="HandyControlDemo.Window.GrowlDemoWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:controls="clr-namespace:HandyControl.Controls;assembly=HandyControl"
xmlns:langs="clr-namespace:HandyControlDemo.Properties.Langs"
DataContext="{Binding GrowlDemo,Source={StaticResource Locator}}"
Title="{x:Static langs:Lang.GrowlDemo}"
Width="800"
Height="500">
<controls:TransitioningContentControl>
<controls:SimplePanel>
<StackPanel Margin="32">
<WrapPanel HorizontalAlignment="Left" VerticalAlignment="Top">
<Button Command="{Binding InfoCmd}" Content="{x:Static langs:Lang.Info}" Margin="0,5,5,5" Style="{StaticResource ButtonInfo}"/>
<Button Command="{Binding SuccessCmd}" Content="{x:Static langs:Lang.Success}" Margin="5" Style="{StaticResource ButtonSuccess}"/>
<Button Command="{Binding WarningCmd}" Content="{x:Static langs:Lang.Warning}" Margin="5" Style="{StaticResource ButtonWarning}"/>
<Button Command="{Binding ErrorCmd}" Content="{x:Static langs:Lang.Error}" Margin="5" Style="{StaticResource ButtonDanger}"/>
<Button Command="{Binding AskCmd}" Content="{x:Static langs:Lang.Ask}" Margin="5" Background="BlueViolet" Foreground="White"/>
<Button Command="{Binding FatalCmd}" Content="{x:Static langs:Lang.Fatal}" Margin="5,0"/>
<Button Command="{Binding ClearCmd}" Content="{x:Static langs:Lang.Clear}" Margin="5,0,0,0" Style="{StaticResource ButtonPrimary}"/>
</WrapPanel>
<Button Command="{Binding NewWindowCmd}" Content="{x:Static langs:Lang.NewWindow}" HorizontalAlignment="Left" Margin="0,5,0,0"/>
</StackPanel>
<controls:ScrollViewer VerticalScrollBarVisibility="Hidden" HorizontalAlignment="Right" IsEnableInertia="True" IsPenetrating="True">
<StackPanel Name="GrowlPanel" VerticalAlignment="Top" Margin="0,10,10,10"/>
</controls:ScrollViewer>
</controls:SimplePanel>
</controls:TransitioningContentControl>
</Window>
@@ -0,0 +1,27 @@
using System;
using HandyControl.Controls;
namespace HandyControlDemo.Window
{
public partial class GrowlDemoWindow
{
public GrowlDemoWindow()
{
InitializeComponent();
}
protected override void OnActivated(EventArgs e)
{
base.OnActivated(e);
Growl.SetGrowlParent(GrowlPanel, true);
}
protected override void OnDeactivated(EventArgs e)
{
base.OnDeactivated(e);
Growl.SetGrowlParent(GrowlPanel, false);
}
}
}