chore: use file-scoped namespace

This commit is contained in:
NaBian committed 2022-03-13 20:28:58 +08:00
1 parent 99d2fafb72
commit bbf1b7d4c6
748 files changed
+57929 -58678

No files matched your search

@@ -3,257 +3,256 @@ using System.Linq;
using System.Windows;
using HandyControl.Data;
namespace HandyControl.Controls
namespace HandyControl.Controls;
public class SideMenu : HeaderedSimpleItemsControl
{
public class SideMenu : HeaderedSimpleItemsControl
private SideMenuItem _selectedItem;
private SideMenuItem _selectedHeader;
private bool _isItemSelected;
public SideMenu()
{
private SideMenuItem _selectedItem;
AddHandler(SideMenuItem.SelectedEvent, new RoutedEventHandler(SideMenuItemSelected));
private SideMenuItem _selectedHeader;
Loaded += (s, e) => Init();
}
private bool _isItemSelected;
protected override void Refresh()
{
base.Refresh();
public SideMenu()
Init();
}
private void Init()
{
if (ItemsHost == null) return;
OnExpandModeChanged(ExpandMode);
}
private void SideMenuItemSelected(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is SideMenuItem item)
{
AddHandler(SideMenuItem.SelectedEvent, new RoutedEventHandler(SideMenuItemSelected));
Loaded += (s, e) => Init();
}
protected override void Refresh()
{
base.Refresh();
Init();
}
private void Init()
{
if (ItemsHost == null) return;
OnExpandModeChanged(ExpandMode);
}
private void SideMenuItemSelected(object sender, RoutedEventArgs e)
{
if (e.OriginalSource is SideMenuItem item)
if (item.Role == SideMenuItemRole.Item)
{
if (item.Role == SideMenuItemRole.Item)
_isItemSelected = true;
if (Equals(item, _selectedItem)) return;
if (_selectedItem != null)
{
_isItemSelected = true;
_selectedItem.IsSelected = false;
}
if (Equals(item, _selectedItem)) return;
if (_selectedItem != null)
_selectedItem = item;
_selectedItem.IsSelected = true;
RaiseEvent(new FunctionEventArgs<object>(SelectionChangedEvent, this)
{
Info = e.OriginalSource
});
}
else
{
if (!Equals(item, _selectedHeader))
{
if (_selectedHeader != null)
{
_selectedItem.IsSelected = false;
if (ExpandMode == ExpandMode.Freedom && item.ItemsHost.IsVisible && !_isItemSelected)
{
item.IsSelected = false;
SwitchPanelArea(item);
return;
}
_selectedHeader.IsSelected = false;
if (ExpandMode != ExpandMode.Freedom)
{
SwitchPanelArea(_selectedHeader);
}
}
_selectedItem = item;
_selectedItem.IsSelected = true;
_selectedHeader = item;
_selectedHeader.IsSelected = true;
SwitchPanelArea(_selectedHeader);
}
else if (ExpandMode == ExpandMode.Freedom && !_isItemSelected)
{
_selectedHeader.IsSelected = false;
SwitchPanelArea(_selectedHeader);
_selectedHeader = null;
}
if (_isItemSelected)
{
_isItemSelected = false;
}
else if (_selectedHeader != null)
{
if (AutoSelect)
{
if (_selectedItem != null)
{
_selectedItem.IsSelected = false;
_selectedItem = null;
}
_selectedHeader.SelectDefaultItem();
}
_isItemSelected = false;
}
if (!item.HasItems)
{
RaiseEvent(new FunctionEventArgs<object>(SelectionChangedEvent, this)
{
Info = e.OriginalSource
});
}
else
}
}
}
private void SwitchPanelArea(SideMenuItem oldItem)
{
switch (ExpandMode)
{
case ExpandMode.ShowAll:
return;
case ExpandMode.ShowOne:
case ExpandMode.Freedom:
case ExpandMode.Accordion:
oldItem.SwitchPanelArea(oldItem.IsSelected);
break;
}
}
protected override DependencyObject GetContainerForItemOverride() => new SideMenuItem();
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
public static readonly DependencyProperty AutoSelectProperty = DependencyProperty.Register(
"AutoSelect", typeof(bool), typeof(SideMenu), new PropertyMetadata(ValueBoxes.TrueBox));
public bool AutoSelect
{
get => (bool) GetValue(AutoSelectProperty);
set => SetValue(AutoSelectProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ExpandModeProperty = DependencyProperty.Register(
"ExpandMode", typeof(ExpandMode), typeof(SideMenu), new PropertyMetadata(default(ExpandMode), OnExpandModeChanged));
private static void OnExpandModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (SideMenu) d;
var v = (ExpandMode) e.NewValue;
if (ctl.ItemsHost == null)
{
return;
}
ctl.OnExpandModeChanged(v);
}
private void OnExpandModeChanged(ExpandMode mode)
{
if (mode == ExpandMode.ShowAll)
{
ShowAll();
}
else if (mode == ExpandMode.ShowOne)
{
SideMenuItem sideMenuItemSelected = null;
foreach (var sideMenuItem in ItemsHost.Children.OfType<SideMenuItem>())
{
if (sideMenuItemSelected != null)
{
if (!Equals(item, _selectedHeader))
sideMenuItem.IsSelected = false;
if (sideMenuItem.ItemsHost != null)
{
if (_selectedHeader != null)
foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType<SideMenuItem>())
{
if (ExpandMode == ExpandMode.Freedom && item.ItemsHost.IsVisible && !_isItemSelected)
{
item.IsSelected = false;
SwitchPanelArea(item);
return;
}
_selectedHeader.IsSelected = false;
if (ExpandMode != ExpandMode.Freedom)
{
SwitchPanelArea(_selectedHeader);
}
sideMenuSubItem.IsSelected = false;
}
_selectedHeader = item;
_selectedHeader.IsSelected = true;
SwitchPanelArea(_selectedHeader);
}
else if (ExpandMode == ExpandMode.Freedom && !_isItemSelected)
}
else if (sideMenuItem.IsSelected)
{
switch (sideMenuItem.Role)
{
_selectedHeader.IsSelected = false;
SwitchPanelArea(_selectedHeader);
_selectedHeader = null;
case SideMenuItemRole.Header:
_selectedHeader = sideMenuItem;
break;
case SideMenuItemRole.Item:
_selectedItem = sideMenuItem;
break;
}
if (_isItemSelected)
ShowSelectedOne(sideMenuItem);
sideMenuItemSelected = sideMenuItem;
if (sideMenuItem.ItemsHost != null)
{
_isItemSelected = false;
}
else if (_selectedHeader != null)
{
if (AutoSelect)
foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType<SideMenuItem>())
{
if (_selectedItem != null)
{
_selectedItem.IsSelected = false;
_selectedItem = null;
}
_selectedHeader.SelectDefaultItem();
}
_isItemSelected = false;
}
if (!item.HasItems)
{
RaiseEvent(new FunctionEventArgs<object>(SelectionChangedEvent, this)
{
Info = e.OriginalSource
});
}
}
}
}
private void SwitchPanelArea(SideMenuItem oldItem)
{
switch (ExpandMode)
{
case ExpandMode.ShowAll:
return;
case ExpandMode.ShowOne:
case ExpandMode.Freedom:
case ExpandMode.Accordion:
oldItem.SwitchPanelArea(oldItem.IsSelected);
break;
}
}
protected override DependencyObject GetContainerForItemOverride() => new SideMenuItem();
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
public static readonly DependencyProperty AutoSelectProperty = DependencyProperty.Register(
"AutoSelect", typeof(bool), typeof(SideMenu), new PropertyMetadata(ValueBoxes.TrueBox));
public bool AutoSelect
{
get => (bool) GetValue(AutoSelectProperty);
set => SetValue(AutoSelectProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty ExpandModeProperty = DependencyProperty.Register(
"ExpandMode", typeof(ExpandMode), typeof(SideMenu), new PropertyMetadata(default(ExpandMode), OnExpandModeChanged));
private static void OnExpandModeChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (SideMenu) d;
var v = (ExpandMode) e.NewValue;
if (ctl.ItemsHost == null)
{
return;
}
ctl.OnExpandModeChanged(v);
}
private void OnExpandModeChanged(ExpandMode mode)
{
if (mode == ExpandMode.ShowAll)
{
ShowAll();
}
else if (mode == ExpandMode.ShowOne)
{
SideMenuItem sideMenuItemSelected = null;
foreach (var sideMenuItem in ItemsHost.Children.OfType<SideMenuItem>())
{
if (sideMenuItemSelected != null)
{
sideMenuItem.IsSelected = false;
if (sideMenuItem.ItemsHost != null)
{
foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType<SideMenuItem>())
{
sideMenuSubItem.IsSelected = false;
}
}
}
else if (sideMenuItem.IsSelected)
{
switch (sideMenuItem.Role)
{
case SideMenuItemRole.Header:
_selectedHeader = sideMenuItem;
break;
case SideMenuItemRole.Item:
_selectedItem = sideMenuItem;
break;
}
ShowSelectedOne(sideMenuItem);
sideMenuItemSelected = sideMenuItem;
if (sideMenuItem.ItemsHost != null)
{
foreach (var sideMenuSubItem in sideMenuItem.ItemsHost.Children.OfType<SideMenuItem>())
else if (sideMenuSubItem.IsSelected)
{
if (_selectedItem != null)
{
sideMenuSubItem.IsSelected = false;
}
else if (sideMenuSubItem.IsSelected)
{
_selectedItem = sideMenuSubItem;
}
_selectedItem = sideMenuSubItem;
}
}
}
}
}
}
}
public ExpandMode ExpandMode
public ExpandMode ExpandMode
{
get => (ExpandMode) GetValue(ExpandModeProperty);
set => SetValue(ExpandModeProperty, value);
}
public static readonly DependencyProperty PanelAreaLengthProperty = DependencyProperty.Register(
"PanelAreaLength", typeof(double), typeof(SideMenu), new PropertyMetadata(double.NaN));
public double PanelAreaLength
{
get => (double) GetValue(PanelAreaLengthProperty);
set => SetValue(PanelAreaLengthProperty, value);
}
private void ShowAll()
{
foreach (var sideMenuItem in ItemsHost.Children.OfType<SideMenuItem>())
{
get => (ExpandMode) GetValue(ExpandModeProperty);
set => SetValue(ExpandModeProperty, value);
}
public static readonly DependencyProperty PanelAreaLengthProperty = DependencyProperty.Register(
"PanelAreaLength", typeof(double), typeof(SideMenu), new PropertyMetadata(double.NaN));
public double PanelAreaLength
{
get => (double) GetValue(PanelAreaLengthProperty);
set => SetValue(PanelAreaLengthProperty, value);
}
private void ShowAll()
{
foreach (var sideMenuItem in ItemsHost.Children.OfType<SideMenuItem>())
{
sideMenuItem.SwitchPanelArea(true);
}
}
private void ShowSelectedOne(SideMenuItem item)
{
foreach (var sideMenuItem in ItemsHost.Children.OfType<SideMenuItem>())
{
sideMenuItem.SwitchPanelArea(Equals(sideMenuItem, item));
}
}
public static readonly RoutedEvent SelectionChangedEvent = EventManager.RegisterRoutedEvent(
"SelectionChanged", RoutingStrategy.Bubble, typeof(EventHandler<FunctionEventArgs<object>>), typeof(SideMenu));
public event EventHandler<FunctionEventArgs<object>> SelectionChanged
{
add => AddHandler(SelectionChangedEvent, value);
remove => RemoveHandler(SelectionChangedEvent, value);
sideMenuItem.SwitchPanelArea(true);
}
}
}
private void ShowSelectedOne(SideMenuItem item)
{
foreach (var sideMenuItem in ItemsHost.Children.OfType<SideMenuItem>())
{
sideMenuItem.SwitchPanelArea(Equals(sideMenuItem, item));
}
}
public static readonly RoutedEvent SelectionChangedEvent = EventManager.RegisterRoutedEvent(
"SelectionChanged", RoutingStrategy.Bubble, typeof(EventHandler<FunctionEventArgs<object>>), typeof(SideMenu));
public event EventHandler<FunctionEventArgs<object>> SelectionChanged
{
add => AddHandler(SelectionChangedEvent, value);
remove => RemoveHandler(SelectionChangedEvent, value);
}
}
@@ -6,212 +6,211 @@ using System.Windows.Input;
using HandyControl.Data;
using HandyControl.Tools.Extension;
namespace HandyControl.Controls
namespace HandyControl.Controls;
public class SideMenuItem : HeaderedSimpleItemsControl, ISelectable, ICommandSource
{
public class SideMenuItem : HeaderedSimpleItemsControl, ISelectable, ICommandSource
private bool _isMouseLeftButtonDown;
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
"Icon", typeof(object), typeof(SideMenuItem), new PropertyMetadata(default(object)));
public object Icon
{
private bool _isMouseLeftButtonDown;
get => GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
public static readonly DependencyProperty IconProperty = DependencyProperty.Register(
"Icon", typeof(object), typeof(SideMenuItem), new PropertyMetadata(default(object)));
public object Icon
public SideMenuItem()
{
SetBinding(ExpandModeProperty, new Binding(SideMenu.ExpandModeProperty.Name)
{
get => GetValue(IconProperty);
set => SetValue(IconProperty, value);
}
RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(SideMenu), 1)
});
}
public SideMenuItem()
internal static readonly DependencyProperty ExpandModeProperty =
SideMenu.ExpandModeProperty.AddOwner(typeof(SideMenuItem), new PropertyMetadata(default(ExpandMode)));
internal ExpandMode ExpandMode
{
get => (ExpandMode) GetValue(ExpandModeProperty);
set => SetValue(ExpandModeProperty, value);
}
protected override void Refresh()
{
if (ItemsHost == null) return;
ItemsHost.Children.Clear();
foreach (var item in Items)
{
SetBinding(ExpandModeProperty, new Binding(SideMenu.ExpandModeProperty.Name)
DependencyObject container;
if (IsItemItsOwnContainerOverride(item))
{
RelativeSource = new RelativeSource(RelativeSourceMode.FindAncestor, typeof(SideMenu), 1)
});
}
internal static readonly DependencyProperty ExpandModeProperty =
SideMenu.ExpandModeProperty.AddOwner(typeof(SideMenuItem), new PropertyMetadata(default(ExpandMode)));
internal ExpandMode ExpandMode
{
get => (ExpandMode) GetValue(ExpandModeProperty);
set => SetValue(ExpandModeProperty, value);
}
protected override void Refresh()
{
if (ItemsHost == null) return;
ItemsHost.Children.Clear();
foreach (var item in Items)
container = item as DependencyObject;
}
else
{
DependencyObject container;
if (IsItemItsOwnContainerOverride(item))
{
container = item as DependencyObject;
}
else
{
container = GetContainerForItemOverride();
PrepareContainerForItemOverride(container, item);
}
if (container is FrameworkElement element)
{
element.Style = ItemContainerStyle;
ItemsHost.Children.Add(element);
}
container = GetContainerForItemOverride();
PrepareContainerForItemOverride(container, item);
}
if (IsLoaded)
if (container is FrameworkElement element)
{
SwitchPanelArea(ExpandMode == ExpandMode.ShowAll || IsSelected);
element.Style = ItemContainerStyle;
ItemsHost.Children.Add(element);
}
}
protected virtual void OnSelected(RoutedEventArgs e)
if (IsLoaded)
{
RaiseEvent(e);
switch (Command)
{
case null:
return;
case RoutedCommand command:
command.Execute(CommandParameter, CommandTarget);
break;
default:
Command.Execute(CommandParameter);
break;
}
}
public static readonly RoutedEvent SelectedEvent =
EventManager.RegisterRoutedEvent("Selected", RoutingStrategy.Bubble,
typeof(RoutedEventHandler), typeof(SideMenuItem));
public event RoutedEventHandler Selected
{
add => AddHandler(SelectedEvent, value);
remove => RemoveHandler(SelectedEvent, value);
}
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
"IsSelected", typeof(bool), typeof(SideMenuItem), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsSelected
{
get => (bool) GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty RoleProperty = DependencyProperty.Register(
"Role", typeof(SideMenuItemRole), typeof(SideMenuItem), new PropertyMetadata(default(SideMenuItemRole)));
public SideMenuItemRole Role
{
get => (SideMenuItemRole) GetValue(RoleProperty);
internal set => SetValue(RoleProperty, value);
}
protected override DependencyObject GetContainerForItemOverride() => new SideMenuItem();
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
_isMouseLeftButtonDown = false;
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
_isMouseLeftButtonDown = true;
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
if (_isMouseLeftButtonDown)
{
IsSelected = true;
OnSelected(new RoutedEventArgs(SelectedEvent, this));
_isMouseLeftButtonDown = false;
}
}
internal void SelectDefaultItem()
{
if (Role == SideMenuItemRole.Header && ItemsHost.Children.Count > 0)
{
var item = ItemsHost.Children.OfType<SideMenuItem>().FirstOrDefault();
if (item is { IsSelected: false })
{
item.OnSelected(new RoutedEventArgs(SelectedEvent, item));
}
}
}
internal void SwitchPanelArea(bool isShow)
{
if (ItemsHost == null) return;
if (Role == SideMenuItemRole.Header)
{
ItemsHost.Show(isShow);
}
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
"Command", typeof(ICommand), typeof(SideMenuItem), new PropertyMetadata(default(ICommand), OnCommandChanged));
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (SideMenuItem) d;
if (e.OldValue is ICommand oldCommand)
{
oldCommand.CanExecuteChanged -= ctl.CanExecuteChanged;
}
if (e.NewValue is ICommand newCommand)
{
newCommand.CanExecuteChanged += ctl.CanExecuteChanged;
}
}
public ICommand Command
{
get => (ICommand) GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register(
"CommandParameter", typeof(object), typeof(SideMenuItem), new PropertyMetadata(default(object)));
public object CommandParameter
{
get => GetValue(CommandParameterProperty);
set => SetValue(CommandParameterProperty, value);
}
public static readonly DependencyProperty CommandTargetProperty = DependencyProperty.Register(
"CommandTarget", typeof(IInputElement), typeof(SideMenuItem), new PropertyMetadata(default(IInputElement)));
public IInputElement CommandTarget
{
get => (IInputElement) GetValue(CommandTargetProperty);
set => SetValue(CommandTargetProperty, value);
}
private void CanExecuteChanged(object sender, EventArgs e)
{
if (Command == null) return;
IsEnabled = Command is RoutedCommand command
? command.CanExecute(CommandParameter, CommandTarget)
: Command.CanExecute(CommandParameter);
SwitchPanelArea(ExpandMode == ExpandMode.ShowAll || IsSelected);
}
}
}
protected virtual void OnSelected(RoutedEventArgs e)
{
RaiseEvent(e);
switch (Command)
{
case null:
return;
case RoutedCommand command:
command.Execute(CommandParameter, CommandTarget);
break;
default:
Command.Execute(CommandParameter);
break;
}
}
public static readonly RoutedEvent SelectedEvent =
EventManager.RegisterRoutedEvent("Selected", RoutingStrategy.Bubble,
typeof(RoutedEventHandler), typeof(SideMenuItem));
public event RoutedEventHandler Selected
{
add => AddHandler(SelectedEvent, value);
remove => RemoveHandler(SelectedEvent, value);
}
public static readonly DependencyProperty IsSelectedProperty = DependencyProperty.Register(
"IsSelected", typeof(bool), typeof(SideMenuItem), new PropertyMetadata(ValueBoxes.FalseBox));
public bool IsSelected
{
get => (bool) GetValue(IsSelectedProperty);
set => SetValue(IsSelectedProperty, ValueBoxes.BooleanBox(value));
}
public static readonly DependencyProperty RoleProperty = DependencyProperty.Register(
"Role", typeof(SideMenuItemRole), typeof(SideMenuItem), new PropertyMetadata(default(SideMenuItemRole)));
public SideMenuItemRole Role
{
get => (SideMenuItemRole) GetValue(RoleProperty);
internal set => SetValue(RoleProperty, value);
}
protected override DependencyObject GetContainerForItemOverride() => new SideMenuItem();
protected override bool IsItemItsOwnContainerOverride(object item) => item is SideMenuItem;
protected override void OnMouseLeave(MouseEventArgs e)
{
base.OnMouseLeave(e);
_isMouseLeftButtonDown = false;
}
protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonDown(e);
_isMouseLeftButtonDown = true;
}
protected override void OnMouseLeftButtonUp(MouseButtonEventArgs e)
{
base.OnMouseLeftButtonUp(e);
if (_isMouseLeftButtonDown)
{
IsSelected = true;
OnSelected(new RoutedEventArgs(SelectedEvent, this));
_isMouseLeftButtonDown = false;
}
}
internal void SelectDefaultItem()
{
if (Role == SideMenuItemRole.Header && ItemsHost.Children.Count > 0)
{
var item = ItemsHost.Children.OfType<SideMenuItem>().FirstOrDefault();
if (item is { IsSelected: false })
{
item.OnSelected(new RoutedEventArgs(SelectedEvent, item));
}
}
}
internal void SwitchPanelArea(bool isShow)
{
if (ItemsHost == null) return;
if (Role == SideMenuItemRole.Header)
{
ItemsHost.Show(isShow);
}
}
public static readonly DependencyProperty CommandProperty = DependencyProperty.Register(
"Command", typeof(ICommand), typeof(SideMenuItem), new PropertyMetadata(default(ICommand), OnCommandChanged));
private static void OnCommandChanged(DependencyObject d, DependencyPropertyChangedEventArgs e)
{
var ctl = (SideMenuItem) d;
if (e.OldValue is ICommand oldCommand)
{
oldCommand.CanExecuteChanged -= ctl.CanExecuteChanged;
}
if (e.NewValue is ICommand newCommand)
{
newCommand.CanExecuteChanged += ctl.CanExecuteChanged;
}
}
public ICommand Command
{
get => (ICommand) GetValue(CommandProperty);
set => SetValue(CommandProperty, value);
}
public static readonly DependencyProperty CommandParameterProperty = DependencyProperty.Register(
"CommandParameter", typeof(object), typeof(SideMenuItem), new PropertyMetadata(default(object)));
public object CommandParameter
{
get => GetValue(CommandParameterProperty);
set => SetValue(CommandParameterProperty, value);
}
public static readonly DependencyProperty CommandTargetProperty = DependencyProperty.Register(
"CommandTarget", typeof(IInputElement), typeof(SideMenuItem), new PropertyMetadata(default(IInputElement)));
public IInputElement CommandTarget
{
get => (IInputElement) GetValue(CommandTargetProperty);
set => SetValue(CommandTargetProperty, value);
}
private void CanExecuteChanged(object sender, EventArgs e)
{
if (Command == null) return;
IsEnabled = Command is RoutedCommand command
? command.CanExecute(CommandParameter, CommandTarget)
: Command.CanExecute(CommandParameter);
}
}