mirror of
https://gitee.com/handyorg/HandyControl.git
synced 2024-12-02 20:07:56 +08:00
Add ImageOpened Event
https://github.com/HandyOrg/HandyControl/issues/1000
This commit is contained in:
parent
5dcb6dc649
commit
87556183a6
@ -12,6 +12,16 @@ namespace HandyControl.Controls
|
|||||||
{
|
{
|
||||||
public class ImageSelector : Control
|
public class ImageSelector : Control
|
||||||
{
|
{
|
||||||
|
public static readonly RoutedEvent ImageOpenedEvent =
|
||||||
|
EventManager.RegisterRoutedEvent("ImageOpened", RoutingStrategy.Bubble,
|
||||||
|
typeof(EventHandler<FunctionEventArgs<bool>>), typeof(ImageSelector));
|
||||||
|
|
||||||
|
public event EventHandler<FunctionEventArgs<bool>> ImageOpened
|
||||||
|
{
|
||||||
|
add => AddHandler(ImageOpenedEvent, value);
|
||||||
|
remove => RemoveHandler(ImageOpenedEvent, 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,10 @@ namespace HandyControl.Controls
|
|||||||
});
|
});
|
||||||
SetValue(HasValuePropertyKey, ValueBoxes.TrueBox);
|
SetValue(HasValuePropertyKey, ValueBoxes.TrueBox);
|
||||||
SetCurrentValue(ToolTipProperty, dialog.FileName);
|
SetCurrentValue(ToolTipProperty, dialog.FileName);
|
||||||
|
RaiseEvent(new FunctionEventArgs<bool>(ImageOpenedEvent, this)
|
||||||
|
{
|
||||||
|
Info = true
|
||||||
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user