本文整理汇总了C#中System.Windows.FrameworkElement.RemoveHandler方法的典型用法代码示例。如果您正苦于以下问题:C# FrameworkElement.RemoveHandler方法的具体用法?C# FrameworkElement.RemoveHandler怎么用?C# FrameworkElement.RemoveHandler使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Windows.FrameworkElement
的用法示例。
在下文中一共展示了FrameworkElement.RemoveHandler方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DetachCommandHandlers
public void DetachCommandHandlers(FrameworkElement sender)
{
sender.RemoveHandler(CommandManager.PreviewCanExecuteEvent, new CanExecuteRoutedEventHandler(PreviewCanExecuteHandler));
sender.RemoveHandler(CommandManager.CanExecuteEvent, new CanExecuteRoutedEventHandler(CanExecuteHandler));
sender.RemoveHandler(CommandManager.PreviewExecutedEvent, new ExecutedRoutedEventHandler(PreviewExecutedHandler));
sender.RemoveHandler(CommandManager.ExecutedEvent, new ExecutedRoutedEventHandler(ExecutedHandler));
}
示例2: AttachOneShotCommandHandler
public static void AttachOneShotCommandHandler(FrameworkElement element, RoutedEvent @event, RoutedEventHandler callback)
{
RoutedEventHandler handler = null;
handler = (arg0, arg1) =>
{
element.RemoveHandler(@event, handler);
callback(arg0, arg1);
};
element.AddHandler(@event, handler);
}
示例3: ExitAction
public void ExitAction(FrameworkElement target, BaseValueSource valueSource)
{
target.RemoveHandler(Event, Handler);
}
示例4: ToggleFocusHandler
protected virtual void ToggleFocusHandler()
{
_focusElement = GetFocusElement(_adornedElement);
if (_visibleOnFocus && !_focusHandlerAdded)
{
_focusElement.AddHandler(FrameworkElement.GotFocusEvent, new RoutedEventHandler(OnGotFocus));
_focusElement.AddHandler(FrameworkElement.LostFocusEvent, new RoutedEventHandler(OnLostFocus));
_focusHandlerAdded = true;
}
else if (!_visibleOnFocus && _focusHandlerAdded)
{
_focusElement.RemoveHandler(FrameworkElement.GotFocusEvent, new RoutedEventHandler(OnGotFocus));
_focusElement.RemoveHandler(FrameworkElement.LostFocusEvent, new RoutedEventHandler(OnLostFocus));
_focusHandlerAdded = false;
}
if (_visibleOnFocus == false && _visible == false)
this.Visibility = Visibility.Collapsed;
else if (_visibleOnFocus == false && _visible == true)
this.Visibility = Visibility.Visible;
else
this.Visibility = (_adornedElement.IsFocused) ? Visibility.Visible : ((_visibleOnFocus) ? Visibility.Collapsed : Visibility.Visible);
}
示例5: RemoveReorderCompletedHandler
/// <summary>
/// Removes the reorder completed handler.
/// </summary>
/// <param name="element">The element.</param>
/// <param name="handler">The handler.</param>
public static void RemoveReorderCompletedHandler(FrameworkElement element,
RoutedPropertyChangedEventHandler<int> handler)
{
element.RemoveHandler(ReorderCompletedEvent, handler);
}