locked
Where have gone Events of Controls ? RRS feed

  • Question

  • Hello,

     

    Switching from Windows Forms, i just can't find where are the events of controls

     you add to a window.

     

    When I add say, a Button, how can i access the Sub Button1_Click ?

     

    I have tried somehow with Expression Blend but when going back to Orcas,

    it produces an error like : Button1_Click is not member of Window1.

     

    Do you have any idea ?

     

    Thank you.

    Sunday, May 20, 2007 2:46 PM

Answers

  • Unfortunately Visual Studio doesn't let you hook up events in the designer. You have to do it in the XAML markup and manually creating the event signatures in source code.

     

    Alternately you can use Expression Blend which does have better PropertySheet support and Event Hookup features, although that UI doesn't work all that well for forms based layout either. I tend to use both editors in combination <shrug>

     

    +++ Rick ---

    Sunday, May 20, 2007 7:37 PM
  • Hello,

     

    I just found something right now,

     

    1. Put a control in the window with the toolbox,
    2. After, the most important, save all files with Shift+Ctrl+S,

     

    When you get back to your code,

    the two top bars that helps you navigate through your procedures etc ... 
      all events of controls added, will be shown as regular ones : with all usual events etc

     

    So that's cool, it takes some pain out of writing manually

     

    (Done on Orcas)

     

    Also, i haven't found any info about PropertySheet you told, which class it in ?

     

    Thanks

    Sunday, May 20, 2007 8:58 PM

All replies

  • Unfortunately Visual Studio doesn't let you hook up events in the designer. You have to do it in the XAML markup and manually creating the event signatures in source code.

     

    Alternately you can use Expression Blend which does have better PropertySheet support and Event Hookup features, although that UI doesn't work all that well for forms based layout either. I tend to use both editors in combination <shrug>

     

    +++ Rick ---

    Sunday, May 20, 2007 7:37 PM
  • Hello,

     

    I just found something right now,

     

    1. Put a control in the window with the toolbox,
    2. After, the most important, save all files with Shift+Ctrl+S,

     

    When you get back to your code,

    the two top bars that helps you navigate through your procedures etc ... 
      all events of controls added, will be shown as regular ones : with all usual events etc

     

    So that's cool, it takes some pain out of writing manually

     

    (Done on Orcas)

     

    Also, i haven't found any info about PropertySheet you told, which class it in ?

     

    Thanks

    Sunday, May 20, 2007 8:58 PM
  • Interesting. I don't see that here... Are you using VB.NET? Maybe it's doing something different than the C# editor, where I don't see any events showing up in the class and member navigators.

     

    +++ Rick ---
    Sunday, May 20, 2007 9:12 PM
  • Yes i use VB,

     

    I have some strange behaviors, normally when i create a new project, on the code there was

     

    ' Interaction logic for Window1.xaml

    Partial Public Class Window1

    Inherits System.Windows.Window

    Public Sub New()

    InitializeComponent()

    End Sub

     

    now only

     

    Class Window1

    End Class

     

    I don't know what to believe in, i mean i don't know which one is correct.

     

    I heard that the XAML page will anyway provide the base class on compile

    http://forums.microsoft.com/forums/ShowPost.aspx?PostID=1623736&SiteID=1

     

     

    I don't really understand, mainly because i'm not an expert !

    Sunday, May 20, 2007 10:11 PM