Declaring an ICommand in Windows 8 Consumer Preview

[Update 24/4/2012]

Well I'll be… after I posted this, a few people wrote to me and told me they are unable to repro the issue. I then tested again and indeed, it works. No idea why I couldn't get it to work in the first place.

More details here. Sorry about the confusion people!
Print | posted on Friday, April 20, 2012 4:43 PM

Feedback

# re: Declaring an ICommand in Windows 8 Consumer Preview

left by Wim Bokkers at 4/20/2012 5:28 PM Gravatar
That's what I already do.
And I don't consider myself a purist.:)

# re: Declaring an ICommand in Windows 8 Consumer Preview

left by Jonathan Allen at 4/20/2012 7:36 PM Gravatar
That's going to be a problem. If I declare something besides ICommand it is because I have other things that I need to invoke. For example, raising the can execute changed event.

# re: Declaring an ICommand in Windows 8 Consumer Preview

left by atomaras at 4/24/2012 5:11 PM Gravatar
I wont be able to raise the CanExecuteChanged event if i store them as ICommand's or i will need to cast every time.So the property return Type could remain ICommand but the instance field be RelayCommand.Indeed wierd though that it fails with subclass...

# re: Declaring an ICommand in Windows 8 Consumer Preview

left by Laurent at 4/24/2012 7:56 PM Gravatar
OK something is really wrong :) I tested again to be sure and I am unable to reproduce. Sorry for the confusion folks... I will restore the old functionality.

Laurent

# re: Declaring an ICommand in Windows 8 Consumer Preview

left by Kyle Burns at 4/27/2012 2:37 PM Gravatar
Not sure what I am doing wrong, but I am seeing the same behavior of my commands only working properly if I have exposed them to the XAML as ICommand.

# re: Declaring an ICommand in Windows 8 Consumer Preview

left by Laurent at 4/28/2012 11:09 AM Gravatar
Hi Kyle,

Can you send me your app, I would love to check what is happening and go to the bottom of this. I know I saw the same behavior, I just want to understand why...

Thanks!
Laurent

# re: Declaring an ICommand in Windows 8 Consumer Preview

left by Alex at 4/29/2012 10:22 AM Gravatar
I've seen this as well working only with ICommand. I have a very basic test app with a button and a Command binding.
RelayCommand or any other ICommand implementation would work only with ICommand property type.
Then I found this... Matt Small (MSFT) confirms this an issue.

http://answers.flyppdevportal.com/categories/metro/csharpvb.aspx?ID=00e65572-97cb-4729-9480-c4406dbe54e8

So, your original post was actually correct )).
Post A Comment
Title:
Name:
Email:
Website:
Comment:
Verification: