Why has the selector class an internal Constructor?
I tried to derive from the Selector class cause I need a similar functionality as the ListBox but it is no ListBox. I had a look at the signature of the Selector class and it is (http://msdn.microsoft.com/en-us/library/system.windows.controls.primitives.selector(v=vs.95).aspx)
public abstract cla开发者_StackOverflowss Selector : ItemsControl,
ISupportInitialize
But the problem is that the constructor is internal. So it is not possible to derive from this class outside the assembly (ListBox and ComboBox are in this assembly).
I now derived from the ListBox to achieve my goal, but my question is:
Why has the selector class an internal Constructor?
Because the Selector
class is abstract
. You can't create instances of abstract classes, and the easiest way to make sure you can't even do that by mistake (in a regular way) is to not make a constructor available.
I don't see an entry for the constructor on the MSDN, but my bet is that it's probably a protected
constructor, not an internal
one.
But from what I can see, nothing stops you from deriving from Selector
, and create your custom implementation.
Edit:
Reflector shows the constructor to be internal
indeed, so no deriving...
精彩评论