[英]Silverlight Application; How can I add code to a buttons event handler?
I'm following this tutorial (beginner Hello World Silverlight Application)我正在关注本教程(初学者 Hello World Silverlight 应用程序)
In this step it shows how to add code to the event handler of a button,在这一步中,它展示了如何向按钮的事件处理程序添加代码,
this is done in a xaml.cs file but i cant find it anywhere, can anybody tell me where I can add code to the event handler of my button in Visual Studio 2010这是在 xaml.cs 文件中完成的,但我无法在任何地方找到它,谁能告诉我在哪里可以将代码添加到 Visual Studio 2010 中按钮的事件处理程序
Firstly, it seems the name of the control created automatically with a new Silverlight project has changed since Silverlight 2 (as in the tutorial you're following).首先,自 Silverlight 2 以来,使用新 Silverlight 项目自动创建的控件的名称似乎已更改(如您正在遵循的教程中)。 A new Silverlight 4 project has MainPage.xaml (and MainPage.xaml.cs) instead of Page.xaml and Page.xaml.cs. A new Silverlight 4 project has MainPage.xaml (and MainPage.xaml.cs) instead of Page.xaml and Page.xaml.cs.
To access MainPage.xaml.cs (which is where you'd put the event handler), expand the MainPage.xaml node in Solution Explorer.要访问 MainPage.xaml.cs(放置事件处理程序的位置),请在解决方案资源管理器中展开 MainPage.xaml 节点。 This should should show MainPage.xaml.cs under MainPage.xaml.这应该在 MainPage.xaml 下显示 MainPage.xaml.cs。 Alternatively, right-click Click="MyButton_Click"
in MainPage.xaml and choose 'Navigate to Event Handler'.或者,右键单击 MainPage.xaml 中的Click="MyButton_Click"
并选择“导航到事件处理程序”。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.