Simple question about mouse events

3 posts, 1 answers
  1. C Bates
    C Bates avatar
    33 posts
    Member since:
    Oct 2009

    Posted 06 Jan 2010 Link to this post

    Hello,
    A simple RadPane containing nested Canvas controls:
          <telerikDocking:RadDocking Grid.Row="1" HorizontalAlignment="Stretch" d:LayoutOverrides="Height"
              <telerikDocking:RadDocking.DocumentHost> 
                  <telerikDocking:RadSplitContainer x:Name="split1"
                      <telerikDocking:RadPaneGroup x:Name="group1"
                          <telerikDocking:RadPane x:Name="pane1" Header="pane1"   
                                                  HorizontalAlignment="Stretch" VerticalAlignment="Stretch" 
                                                  MouseLeftButtonDown="pane1_MouseLeftButtonDown"
                                  <Canvas x:Name="canvas1" MouseLeftButtonDown="c1_MouseLeftButtonDown"
                                    <Canvas x:Name="Canvas2" MouseLeftButtonDown="Canvas2_MouseLeftButtonDown"
                                        <Rectangle Height="40" Width="60" Fill="AliceBlue"/> 
                                    </Canvas> 
                                </Canvas> 
                              </telerikDocking:RadPane> 
                      </telerikDocking:RadPaneGroup> 
                  </telerikDocking:RadSplitContainer> 
              </telerikDocking:RadDocking.DocumentHost> 
          </telerikDocking:RadDocking> 
     
    How do I get mouse events at the Canvas level?  None of the MouseLeftButtonDown handlers are called when I click on the canvas, but the two handlers attached to the Canvas controls are called when I click on the Rectangle.
    Thanks for the help.


  2. Answer
    Hristo
    Admin
    Hristo avatar
    832 posts

    Posted 07 Jan 2010 Link to this post

    Hello C Bates,

    All panels (like Canvas, Grid, StackPanel) should have Background set in order to receive Mouse related events. This is required by the framework. Transparent background will also work.

    Let us know if you need more information.

    Kind regards,
    Hristo
    the Telerik team

    Instantly find answers to your questions on the new Telerik Support Portal.
    Watch a video on how to optimize your support resource searches and check out more tips on the blogs.
  3. C Bates
    C Bates avatar
    33 posts
    Member since:
    Oct 2009

    Posted 08 Jan 2010 Link to this post

    Thanks for the quick reply.
Back to Top