custom user control added to a parent panel not firing Pointer Events RRS feed

  • Question

  • Hi,

    i have a custom control derived from UserControl like the following - Note: i dont have a Xaml control defined for this, this is all done in C++ code.

    public ref class ToolUserControlBase: public UserControl { //other functions omitted for brevity }

    and in the constructor of this, i am doing the following 

    PointerPressed += ref new PointerEventHandler(this, &ToolUserControlBase::OnPointerPressed);

    Loaded += ref new RoutedEventHandler(this, &ToolUserControlBase::OnLoaded);

    i am adding this control to a Grid element (which raises the OnLoaded event)

    in the OnLoaded event i am setting the width and height of the control to the parents width and height

    the problem is that the pointer events are not firing at all on this user-control.

    i tried checking the visibility , IsHitTestVisible , IsEnabled properties and everything is fine. 

    Note: If i create a Xaml control derived from this usercontrol and then add that xaml control to parent then things work fine but if i just directly create and add this user-control then the events dont fire at all.

    Am i missing anything here? do i need to initialize any appropriate members variables of the UserControl in the constructor ? 



    Monday, November 18, 2013 4:00 PM

All replies

  • Hi Raj,

    Can you please provide a minimal sample demonstrating the working and non-working scenarios so we can see more clearly what your code is doing?


    Tuesday, November 19, 2013 2:13 AM