Merge pull request #1001 from ghost1372/addEvent/ImageSelector

Add ImageOpened Event
This commit is contained in:
NaBian authored and GitHub committed 2021-11-15 22:50:37 +08:00
commit faf614dc24
1 file changed
+11
@@ -12,6 +12,16 @@ namespace HandyControl.Controls
{
public class ImageSelector : Control
{
public static readonly RoutedEvent ImageSelectedEvent =
EventManager.RegisterRoutedEvent("ImageSelected", RoutingStrategy.Bubble,
typeof(RoutedEventHandler), typeof(ImageSelector));
public event RoutedEventHandler ImageSelected
{
add => AddHandler(ImageSelectedEvent, value);
remove => RemoveHandler(ImageSelectedEvent, value);
}
public ImageSelector() => CommandBindings.Add(new CommandBinding(ControlCommands.Switch, SwitchImage));
private void SwitchImage(object sender, ExecutedRoutedEventArgs e)
@@ -34,6 +44,7 @@ namespace HandyControl.Controls
});
SetValue(HasValuePropertyKey, ValueBoxes.TrueBox);
SetCurrentValue(ToolTipProperty, dialog.FileName);
RaiseEvent(new RoutedEventArgs(ImageSelectedEvent, this));
}
}
else