This commit is contained in:
NaBian committed 2021-11-15 23:07:48 +08:00
commit b1fef59ad5
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