Merge pull request #1001 from ghost1372/addEvent/ImageSelector
Add ImageOpened Event
This commit is contained in:
1 file changed
+11
@@ -12,6 +12,16 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
public class ImageSelector : Control
|
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));
|
public ImageSelector() => CommandBindings.Add(new CommandBinding(ControlCommands.Switch, SwitchImage));
|
||||||
|
|
||||||
private void SwitchImage(object sender, ExecutedRoutedEventArgs e)
|
private void SwitchImage(object sender, ExecutedRoutedEventArgs e)
|
||||||
@@ -34,6 +44,7 @@ namespace HandyControl.Controls
|
|||||||
});
|
});
|
||||||
SetValue(HasValuePropertyKey, ValueBoxes.TrueBox);
|
SetValue(HasValuePropertyKey, ValueBoxes.TrueBox);
|
||||||
SetCurrentValue(ToolTipProperty, dialog.FileName);
|
SetCurrentValue(ToolTipProperty, dialog.FileName);
|
||||||
|
RaiseEvent(new RoutedEventArgs(ImageSelectedEvent, this));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in new issue
Block a user