diff --git a/HandyControl/Controls/Attach/PanelElement.cs b/HandyControl/Controls/Attach/PanelElement.cs
index f1788378..05578452 100644
--- a/HandyControl/Controls/Attach/PanelElement.cs
+++ b/HandyControl/Controls/Attach/PanelElement.cs
@@ -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);
}
}
diff --git a/HandyControl/Controls/Input/SearchBar.cs b/HandyControl/Controls/Input/SearchBar.cs
index d34a3557..3b13e84e 100644
--- a/HandyControl/Controls/Input/SearchBar.cs
+++ b/HandyControl/Controls/Input/SearchBar.cs
@@ -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);
+ }
}
///
@@ -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);
+ }
}
}
diff --git a/HandyControl/Controls/Other/Growl.cs b/HandyControl/Controls/Other/Growl.cs
index f6ec5b4c..ed274460 100644
--- a/HandyControl/Controls/Other/Growl.cs
+++ b/HandyControl/Controls/Other/Growl.cs
@@ -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;
- ///
- /// 消息容器
- ///
- public static Panel GrowlPanel { get; set; }
-
///
/// 计数
///
@@ -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 ActionBeforeClose { get; set; }
+ ///
+ /// 消息容器
+ ///
+ 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(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);
}
diff --git a/HandyControl/Controls/Window/MessageBox.cs b/HandyControl/Controls/Window/MessageBox.cs
index 36007596..67342fd7 100644
--- a/HandyControl/Controls/Window/MessageBox.cs
+++ b/HandyControl/Controls/Window/MessageBox.cs
@@ -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
///
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(ResourceToken.SuccessGeometry);
- messageBox._imageBrush = ResourceHelper.GetResource(ResourceToken.SuccessBrush);
+ messageBox.ShowImage = true;
+ messageBox.Image = ResourceHelper.GetResource(ResourceToken.SuccessGeometry);
+ messageBox.ImageBrush = ResourceHelper.GetResource(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(ResourceToken.FatalGeometry);
- messageBox._imageBrush = ResourceHelper.GetResource(ResourceToken.PrimaryTextBrush);
+ messageBox.ShowImage = true;
+ messageBox.Image = ResourceHelper.GetResource(ResourceToken.FatalGeometry);
+ messageBox.ImageBrush = ResourceHelper.GetResource(ResourceToken.PrimaryTextBrush);
messageBox.ShowDialog();
});
@@ -217,9 +263,9 @@ namespace HandyControl.Controls
if (!string.IsNullOrEmpty(info.IconKey))
{
- messageBox._showImage = true;
- messageBox._image = ResourceHelper.GetResource(info.IconKey);
- messageBox._imageBrush = ResourceHelper.GetResource(info.IconBrushKey);
+ messageBox.ShowImage = true;
+ messageBox.Image = ResourceHelper.GetResource(info.IconKey);
+ messageBox.ImageBrush = ResourceHelper.GetResource(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(iconKey);
- messageBox._imageBrush = ResourceHelper.GetResource(iconBrushKey);
+ messageBox.ShowImage = true;
+ messageBox.Image = ResourceHelper.GetResource(iconKey);
+ messageBox.ImageBrush = ResourceHelper.GetResource(iconBrushKey);
}
private static bool IsValidMessageBoxButton(MessageBoxButton value)
diff --git a/HandyControl/Controls/Window/Window.cs b/HandyControl/Controls/Window/Window.cs
index ee8d9fc1..be713cfb 100644
--- a/HandyControl/Controls/Window/Window.cs
+++ b/HandyControl/Controls/Window/Window.cs
@@ -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();
}
-
- ///
- /// 获取自定义窗口
- ///
- ///
- public static Window GetCustomWindow(FrameworkElement content)
- {
- var window = new Window
- {
- Style = ResourceHelper.GetResource
-
\ No newline at end of file
diff --git a/HandyControl/Themes/Styles/Window.xaml b/HandyControl/Themes/Styles/Window.xaml
index c31413e4..c93bc3f5 100644
--- a/HandyControl/Themes/Styles/Window.xaml
+++ b/HandyControl/Themes/Styles/Window.xaml
@@ -46,25 +46,26 @@
-
-
\ No newline at end of file
diff --git a/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml
index 7f5b6932..7739acc0 100644
--- a/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/GrowlDemoCtl.xaml
@@ -6,14 +6,17 @@
DataContext="{Binding GrowlDemo,Source={StaticResource Locator}}"
Background="{DynamicResource RegionBrush}">
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HandyControlDemo/UserControl/Controls/SearchBarDemoCtl.xaml b/HandyControlDemo/UserControl/Controls/SearchBarDemoCtl.xaml
index 3159c30f..cc484896 100644
--- a/HandyControlDemo/UserControl/Controls/SearchBarDemoCtl.xaml
+++ b/HandyControlDemo/UserControl/Controls/SearchBarDemoCtl.xaml
@@ -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}">
-
+
diff --git a/HandyControlDemo/ViewModel/Controls/GrowlDemoViewModel.cs b/HandyControlDemo/ViewModel/Controls/GrowlDemoViewModel.cs
index e752c50c..6c0ce412 100644
--- a/HandyControlDemo/ViewModel/Controls/GrowlDemoViewModel.cs
+++ b/HandyControlDemo/ViewModel/Controls/GrowlDemoViewModel.cs
@@ -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(() =>
new RelayCommand(Growl.Clear)).Value;
+
+ public RelayCommand NewWindowCmd => new Lazy(() =>
+ new RelayCommand(() => new GrowlDemoWindow().Show())).Value;
}
}
\ No newline at end of file
diff --git a/HandyControlDemo/ViewModel/Controls/SearchBarDemoViewModel.cs b/HandyControlDemo/ViewModel/Controls/SearchBarDemoViewModel.cs
new file mode 100644
index 00000000..75dccd5f
--- /dev/null
+++ b/HandyControlDemo/ViewModel/Controls/SearchBarDemoViewModel.cs
@@ -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 SearchCmd => new Lazy>(() =>
+ new RelayCommand(Search)).Value;
+
+ private void Search(string key)
+ {
+ Growl.Info(key);
+ }
+ }
+}
\ No newline at end of file
diff --git a/HandyControlDemo/ViewModel/ViewModelLocator.cs b/HandyControlDemo/ViewModel/ViewModelLocator.cs
index 960bdef1..800ce4fe 100644
--- a/HandyControlDemo/ViewModel/ViewModelLocator.cs
+++ b/HandyControlDemo/ViewModel/ViewModelLocator.cs
@@ -25,6 +25,7 @@ namespace HandyControlDemo.ViewModel
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
SimpleIoc.Default.Register();
+ SimpleIoc.Default.Register();
}
public static ViewModelLocator Instance => new Lazy(() =>
@@ -54,6 +55,8 @@ namespace HandyControlDemo.ViewModel
public DialogDemoViewModel DialogDemo => ServiceLocator.Current.GetInstance();
+ public SearchBarDemoViewModel SearchBarDemo => ServiceLocator.Current.GetInstance();
+
#endregion
}
}
\ No newline at end of file
diff --git a/HandyControlDemo/Window/GrowlDemoWindow.xaml b/HandyControlDemo/Window/GrowlDemoWindow.xaml
new file mode 100644
index 00000000..c77f86a7
--- /dev/null
+++ b/HandyControlDemo/Window/GrowlDemoWindow.xaml
@@ -0,0 +1,29 @@
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
diff --git a/HandyControlDemo/Window/GrowlDemoWindow.xaml.cs b/HandyControlDemo/Window/GrowlDemoWindow.xaml.cs
new file mode 100644
index 00000000..225a77ed
--- /dev/null
+++ b/HandyControlDemo/Window/GrowlDemoWindow.xaml.cs
@@ -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);
+ }
+ }
+}