Replies: 5 comments
-
Are you specifying that MyControl derives from Selector in your .idl file? Then MyControl should derive from MyControlT in your cpp file. |
Beta Was this translation helpful? Give feedback.
-
In my case , where MyControl will be used in the same compilation unit, there is no need of modeling it with idl. What makes me confused is how can we get an instance of Selector without using a factory. Hope advice from you guys. |
Beta Was this translation helpful? Give feedback.
-
because Selector is abstract the only way to "derive" from it in cppwinrt is to do so in an idl definition of your type and then use the cppwinrt generated classes to derive from the projection. What you're attempting to do is implement Selector with MyControl, which isn't allowed because Selector is abstract. As to why Selector is abstract, I'm not sure. @MikeHillberg or @ranjeshj might know. |
Beta Was this translation helpful? Give feedback.
-
Standard C++ has no abstract keyword. It's an extension in Visual C++ however C++/WinRT doesn't use it to be portable. I guess the documentation is wrong and I have reported it: MicrosoftDocs/winrt-api#1971 |
Beta Was this translation helpful? Give feedback.
-
my dear @JaiganeshKumaran I am not sure if this is off topic. |
Beta Was this translation helpful? Give feedback.
-
I trying to implement a custom control. Which I choose to derive from Selector, in cppwinrt I should write something like this
This code does not compile, since there is no such struct as SelectorT.
Despite of this, I dived into this doc found that Selector has no public accessible constructor.
I also checked the winmd file , found that ISelectorFactory is just a marker interface with no method which means Selector is not constructable from the outside.
But there do exist some builtin controls which derive from Selector , for example the ListBox, which I guess must construct Selector instance without using a factory.
So can I conclude that we can't extend Selector from the outside ? Many thanks.
Beta Was this translation helpful? Give feedback.
All reactions