locked
Delegating ctors in WinRT type

    Question

  • Hello, I'm trying to use delegating ctors(MSVS 2012 November CTP) with WinRT type:

    DelegateCommand::DelegateCommand(ExecuteDelegate^ executeHandler):
        DelegateCommand(executeHandler, nullptr)
    {
    }
     
    DelegateCommand::DelegateCommand(ExecuteDelegate^ executeHandler,
        CanExecuteDelegate^ canExecuteHandler):
        m_ExecuteDelegate(executeHandler),
        m_CanExecuteDelegate(canExecuteHandler)
    {
        assert(m_ExecuteDelegate);
    }

    But it fails to compile with the following error:

    error C2039: '<Dispose>' : is not a member of App::Common::DelegateCommand'

    Is there a way to use delegating ctors with WinRT?

    Tuesday, July 23, 2013 10:46 AM

Answers

All replies

  • hi,ixSci

    I wonder that whether your DelegateCommand being inherited from others?or it just a ref class?or it just from

     Microsoft.Practices.Composite.Presentation.Commands?I think C2039 <Dispose> can't expose the issue.

    Then,I'm so grateful for you if you teach me your understand about Delegating ctors.In my mind,the class delegating is just used as parameter or callback or event,I have never thought I can do something with it ctors.

    Wednesday, July 24, 2013 8:07 AM
    Moderator
  • Declaration of the DelegateCommand class is as follows:

    public ref class DelegateCommand sealed: Windows::UI::Xaml::Input::ICommand
    

    Not sure about your question regarding delegating ctors but it is just a feature from the C++11. You can read about it there, for example

    Thursday, July 25, 2013 6:06 AM
  • It's so useful!,thanks for your shared!

    Thursday, July 25, 2013 10:10 AM
    Moderator
  • Hello,

    There have been a number of bug fixes surrounding DelegateCommand. Is there a reason why you are still using the CTP? Can you try the RTM version with update 1 & 2 installed and let us know if it still reproduces?

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Thursday, August 1, 2013 12:13 AM
    Moderator
  • Hi James, November CTP is post-release update which added a few more C++11 features. So I have RTM version with all updates installed. I will wait for 2013 RTM and post bug if it still be there
    Thursday, August 1, 2013 6:57 AM
  • Hello,

    You can always feel free to file a bug on the Visual Studio Connect site (keep in mind this is not for WinRT APIs).

    That said make sure under VS->help->about the version listed is: "11.0.60610.01 Update 3"

    https://connect.microsoft.com/

    Thanks,

    James


    Windows SDK Technologies - Microsoft Developer Services - http://blogs.msdn.com/mediasdkstuff/

    Thursday, August 1, 2013 11:00 PM
    Moderator