none
Why am I seeing 'Windows.UI.Xaml.Input.ICommand' is inaccessible due to its protection ?

    Question

  • I'm just working on some demo code - building on top of WindowsBlogReaderCS.

    When I try to add an ICommand to the code I see:

    Error 1 'Windows.UI.Xaml.Input.ICommand' is inaccessible due to its protection level C:\Projects\WinRt\WindowsBlogReaderCS\WindowsBlogReaderCS\SplitPage.xaml.cs 186 58 WindowsBlogReaderCS

    But I don't understand this at all.

    I've read quite a few tutorials and samples - but these are mainly from the developer release, not from the consumer preview release.

    Which ICommand should I be inheriting from? Is there a sample anywhere for the consumer preview release?

    Thanks

    Wednesday, March 14, 2012 12:35 PM

Answers

All replies

  • It's about public/protected/internal/private attributes.

    Can you show the code ?


    - NV

    Wednesday, March 14, 2012 1:38 PM
  • I'm literally just trying to add a class that implements ICommand - like   

        public class MyCommand : Windows.UI.Xaml.Input.ICommand
        {
            public EventRegistrationToken add_CanExecuteChanged(EventHandler value)
            {
                throw new NotImplementedException();
            }
    
            public void remove_CanExecuteChanged(EventRegistrationToken token)
            {
                throw new NotImplementedException();
            }
    
            public void Execute(object parameter)
            {
                throw new NotImplementedException();
            }
    
            public bool CanExecute(object parameter)
            {
                throw new NotImplementedException();
            }
        }
    
    

    Wednesday, March 14, 2012 4:23 PM
  • Use System.Windows.Input.ICommand.

    Joe

    Wednesday, March 14, 2012 4:51 PM
  • Please update the documentation to reflect this, then.  I went looking specifically at Windows.UI.Xaml.Controls.Button's Command parameter and it is a Windows.UI.Xaml.Input.ICommand. How is anyone supposed to know to switch to the WPF ICommand?  This makes your APIs very frustrating to use.  Why re-namespace everything if you aren't really going to re-namespace everything? Make this public. 
    Sunday, May 06, 2012 3:55 PM