locked
Event mouse.enter doesn't raised nor MouseLeftButtonDown of control image RRS feed

  • Question

  • Hello

       i am a newbie in windows phone programming

      So i try to develop an app....

     On the grid ""ContentPanel",i placed an image control.

    I try to check the event mouseenter 

    Private Sub Image1_MouseEnter(sender As Object, e As System.Windows.Input.MouseEventArgs) Handles Image1.MouseEnter
            MessageBox.Show("MouseEnter")
        End Sub
     
        Private Sub Image1_MouseLeftButtonDown(sender As Object, e As System.Windows.Input.MouseButtonEventArgs) Handles Image1.MouseLeftButtonDown
            MessageBox.Show("MouseLeftButtonDown")
        End Sub

    When i run the app and click image1  any event are raised ,i even put a breakpoint but it never gets there.

    Thanks

    Wednesday, September 28, 2016 7:01 PM

Answers

  • Hi Shay_w,

    As far as I know, the ContentPanel use to deploy your application content. And its size should be changed based on the content that put in it. For example, if there doesn't has any controls in ContentPanel, its should doesn't have size, this is why the MouseEnter event is not raised. But if you out any content in it, when your click the control, the MouseEnter event will be raised. This is because its size is the same with the control that you put.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Weiwei CaiModerator Thursday, October 6, 2016 8:43 AM
    • Marked as answer by Shay_w Thursday, October 6, 2016 10:41 AM
    Wednesday, October 5, 2016 2:54 AM
    Moderator

All replies

  • Hi Shay_w,

    Which version of Visual Studio and Silverlight Windows Phone do you use?

    I create a Windows Phone 8.1 for Silverlight app with Visual Studio 2013 with Update 5. When I run my Windows Phone Silverlight 8.1 app with Emulator 8.1 WVGA 4 inch 512 MB Windows Phone Emulator, after I click the image, both of the message box in MouseEnter and MouseLeftButtonDown pop up.

    Please change another Windows Phone emulator or deploy your app to a Windows Phone device to confirm whetehr this issue related to Windows Phone emulator or not.

    If it also doesn't work on another emulator or device, I'm afraid that there has any problem on your application. Please share your app here. I will try it in my side to check whether there has any problem.

    If it works fine on another emulator or device, I suggest you uninsatll your Windows Phone Emulator and reinstall again to check whether this issue can be fixed.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Thursday, September 29, 2016 1:31 PM
    Moderator
  •   Hi

    I am still developing with windows phone 7.2. 

    I think the problem is not the emulator. 

    To be sure 

    I open an another app , put an image  and put a break point at the code line 

    Private Sub Image1_MouseEnter(sender As Object, e As System.Windows.Input.MouseEventArgs) Handles Image1.MouseEnter
            MessageBox.Show("MouseEnter")
        End Sub

    and ... It works fine.

    I think the best is to rebuild the app 

    Thursday, September 29, 2016 2:52 PM
  • Hi Shay_w,

    Thanks for your response.

    Since another app working fine, the problem should be related to that specific app.

    Please feel free to let me know the result after rebuild the app. If rebuild could not resolve this issue, I suggest you create a new app and then move your original project files to the new project. And the run it in the new app.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    Friday, September 30, 2016 6:17 AM
    Moderator
  • Hi

    After analyse ,i found  what happened.I deleted all the controls and let only the layoutroot and the contentpanel

    also i reduced the size of the contentpanel and colored its background 

    in the program code part

    Private Sub ContentPanel_MouseEnter(sender As Object, e As System.Windows.Input.MouseEventArgs) Handles ContentPanel.MouseEnter
            MessageBox.Show("you reach content panel")
        End Sub

    I run and clicked  the contentpanel and.... nothing happened but if i called the 

    Private Sub LayoutRoot_MouseEnter(sender As Object, e As System.Windows.Input.MouseEventArgs) Handles LayoutRoot.MouseEnter
            MessageBox.Show("you reach layout")
        End Sub

    and run and clicked messagebox is shown "you reach layout"

    so conclusion if i  place control on the contentpanel  any events will be raised only if i place controls on the layoutroot

    so what the use of the contentpanel ? 

    Friday, September 30, 2016 11:38 AM
  • Hi Shay_w,

    As far as I know, the ContentPanel use to deploy your application content. And its size should be changed based on the content that put in it. For example, if there doesn't has any controls in ContentPanel, its should doesn't have size, this is why the MouseEnter event is not raised. But if you out any content in it, when your click the control, the MouseEnter event will be raised. This is because its size is the same with the control that you put.

    Best Regards,
    Weiwei


    We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
    Click HERE to participate the survey.

    • Proposed as answer by Weiwei CaiModerator Thursday, October 6, 2016 8:43 AM
    • Marked as answer by Shay_w Thursday, October 6, 2016 10:41 AM
    Wednesday, October 5, 2016 2:54 AM
    Moderator