Class CommandBehaviorBase<T>
Base behavior to handle connecting a System.Windows.Controls.Control to a Command.
Inheritance
System.Object
CommandBehaviorBase<T>
Namespace: Syncfusion.Windows.Shared
Assembly: Syncfusion.Shared.MVVM.WPF.dll
Syntax
public class CommandBehaviorBase<T> : Object where T : UIElement
Type Parameters
Name | Description |
---|---|
T | The target object must derive from Control |
Remarks
CommandBehaviorBase can be used to provide new behaviors for commands.
Constructors
CommandBehaviorBase()
Constructor specifying the target object.
Declaration
public CommandBehaviorBase()
Properties
Command
Corresponding command to be execute and monitored for System.Windows.Input.ICommand.CanExecuteChanged
Declaration
public ICommand Command { get; set; }
Property Value
Type |
---|
System.Windows.Input.ICommand |
CommandCanExecuteCheckEnabled
Declaration
public bool CommandCanExecuteCheckEnabled { get; set; }
Property Value
Type |
---|
System.Boolean |
CommandParameter
The parameter to supply the command during execution
Declaration
public object CommandParameter { get; set; }
Property Value
Type |
---|
System.Object |
TargetObject
Object to which this behavior is attached.
Declaration
protected T TargetObject { get; }
Property Value
Type |
---|
T |
Methods
ExecuteCommand()
Executes the command, if it's set, providing the CommandParameter
Declaration
protected virtual void ExecuteCommand()
GetCommandParameter<TParameter>()
Declaration
public TParameter GetCommandParameter<TParameter>()
where TParameter : class
Returns
Type |
---|
TParameter |
Type Parameters
Name |
---|
TParameter |
OnTargetAttached()
Declaration
protected virtual void OnTargetAttached()
SetCommandParameter<TParameter>(TParameter)
Declaration
public void SetCommandParameter<TParameter>(TParameter tParameter)
Parameters
Type | Name | Description |
---|---|---|
TParameter | tParameter |
Type Parameters
Name |
---|
TParameter |
SetTargetObject(T)
Declaration
public void SetTargetObject(T control)
Parameters
Type | Name | Description |
---|---|---|
T | control |
UpdateEnabledState()
Updates the target object's IsEnabled property based on the commands ability to execute.
Declaration
protected virtual void UpdateEnabledState()