Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reduce Ambiguity in MVVM (Full) CommandBinding #12

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions MVVM/CommandBinding.cls
Original file line number Diff line number Diff line change
Expand Up @@ -147,16 +147,16 @@ Private Property Get ICommandBinding_Command() As ICommand
Set ICommandBinding_Command = this.Command
End Property

Private Sub ICommandBinding_EvaluateCanExecute(ByVal Context As Object)
EvaluateCanExecute Context
Private Sub ICommandBinding_EvaluateCanExecute
EvaluateCanExecute
End Sub

Private Sub EvaluateCanExecute(ByVal Source As Object)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't remove the parentheses though

Private Sub EvaluateCanExecute
If this.Target Is Nothing Then Exit Sub
If this.Command Is Nothing Then
this.Target.Enabled = False
Else
this.Target.Enabled = this.Command.CanExecute(Source)
this.Target.Enabled = this.Command.CanExecute(this.ViewModel)
End If
End Sub

Expand Down
2 changes: 1 addition & 1 deletion MVVM/ICommandBinding.cls
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,6 @@ Attribute Command.VB_Description = "Gets the command bound to the event source."
End Property

'@Description "Evaluates whether the command can execute given the binding context."
Public Sub EvaluateCanExecute(ByVal Context As Object)
Public Sub EvaluateCanExecute
Attribute EvaluateCanExecute.VB_Description = "Evaluates whether the command can execute given the binding context."
End Sub