locked
Blend Button Problem? RRS feed

  • Question

  • Hi

    I was trying to build a video player in Blend but once I am done creating the buttons and I go into Visual Studio to give them the proper code, I click "Test Solution" an error message comes up saying that my player "does not contain a definition for Play_Click" I am pretty sure that I have done it right, but if anyone has any ideas what is wrong that would be great. If I deleat the buttons the video comes up fine.

    Thanks
    Monday, June 1, 2009 12:28 AM

All replies

  • Hi Paul,
                 This might be because Blend doesn't have the updated code behind files. Can you please try re-loading the solution in Blend and check if that works. If this doesn't work please send a copy of your project or a small sample at navits@microsoft.com and we will see whats wrong with it.

    Regards,
    Navit Saxena
    Tuesday, June 2, 2009 9:19 PM
  • Thanks I will try that.
    Thursday, June 4, 2009 12:38 AM
  • Howdy,

    This happens for a number of reasons, but specifically because you have an event handler specified in the XAML without the appropriate code behind event handler added.

    In blend, select the "Play" button and then in the properties panel, have a look in the events section for the Click event. You should see that it is already filled in (with the Play_Click shown in the error). Clear that and double click in that event box again. It should switch you then to Visual Studio with something similar to the following showing:

    void Play_Click(object sender, RoutedEventArgs e)
    {
       //..
    }


    HTH

    Cheers

    Expression MVP

    my blog : http://x-coders.com/blogs/sneaky/default.aspx

    Thursday, June 4, 2009 2:45 PM
    Moderator