简体   繁体   English

Silverlight 应用; 如何将代码添加到按钮事件处理程序?

[英]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,在这一步中,它展示了如何向按钮的事件处理程序添加代码,

http://silverlight1blogpost.s3.amazonaws.com/step15.png

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.

相关问题 无法在Silverlight中添加事件处理程序 - Unable to add a event handler in silverlight Silverlight:我可以在XAML中将事件设置为基类事件处理程序吗? - Silverlight: Can I set an event to a base class event handler in XAML? 如何使用Silverlight在代码隐藏中的复选框中添加“选中” /“未选中”事件处理程序? - How do I add a 'checked'/'unchecked' event handler to a checkbox in codebehind using Silverlight? 如何将事件聚合添加到现有的Silverlight应用程序? - How Can I Add Event Aggregation To An Existing Silverlight App? 如何在Silverlight的cs代码中为控件添加GestureListener处理程序? - How to add GestureListener handler to a control in cs code in silverlight? 如何将具有相同WCF RIA服务的多个Silverlight库添加到一个Silverlight应用程序? - How can I add multiple Silverlight libraries with same WCF RIA service to one Silverlight application? 我可以在Silverlight 3应用程序中添加dll吗? - Can I add dll to Silverlight 3 application? 如何使用按钮创建自定义控件以及如何在 silverlight 中为 windows mobile 7 添加事件按钮单击事件 - How to create custom control with buttons and how to add event button click event in silverlight for windows mobile 7 如何在Silverlight 4应用程序中刷新浏览器? - How can I refresh browser in silverlight 4 application? 如何在Silverlight中为HyperlinkBut​​ton添加下划线? - How can I add an underline to a HyperlinkButton in Silverlight?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM