locked
Custom ItemsControl with Selection RRS feed

  • Question

  • Hello,

    I want to implement a custom control that inherits from ItemsControl that has the capability to select items.  My initial thought was to inherit from the Selection base class but quickly ran in to trouble as the constructor/s? for the Selector base class are internal. 

    What would I have to do internally in order to implement the Selector base class and then my custom control?

    Thanks.

    Wednesday, January 22, 2014 9:45 PM

All replies

  • I don't know exactly why you would need to use the constructor for the Selector in a derived class - you should be able to just inherit from selector.  Can you explain the actual problem you're running into?

    Matt Small - Microsoft Escalation Engineer - Forum Moderator
    If my reply answers your question, please mark this post as answered.

    NOTE: If I ask for code, please provide something that I can drop directly into a project and run (including XAML), or an actual application project. I'm trying to help a lot of people, so I don't have time to figure out weird snippets with undefined objects and unknown namespaces.

    Thursday, January 23, 2014 8:13 PM
    Moderator
  • I thought I would be able to as well, unfortunately that is not the case, I get an error along the lines of "the class Selector contains no constructors" (i.e. they're internal to the assembly in which it was defined)

    I thought this was somewhat odd seeing as the class itself is public yet you can't do anything with it, also the Item counterpart of the Selector base class has been made publicly available and I am able to inherit from it.

    Here's the simplist reproduction of the error

    using Windows.UI.Xaml.Controls.Primitives;
    
    public class SomeSelector : Selector
    {
    	public SomeSelector( )
    	{
    
    	}
    }

    I'd love to know the reasoning behind this.

    Cheers.


    Friday, January 24, 2014 1:56 PM