如何以编程方式向Ellipse添加行为? (C#)

问题描述:

提前谢谢!

您好,您想要做的是打开xaml.cs文件(右键单击它并选择编辑视觉工作室,或者如果使用混合3,双击它)
这将允许您直接编辑它。如果要设置鼠标悬停,单击等行为,则在xaml文件中转到事件面板(闪电),然后在要为其创建事件处理程序的任何事件的文本框中双击。这将自动生成事件处理程序并打开xaml.cs文件,您可以在其中添加cs代码。
Hi Bolly, what you want to do is open the xaml.cs file(right click on it and choose edit in visual studio, or if using blend 3, double click it)
This will allow you to edit it directly. If you want to set up behavior such as mouse over, click, etc, then in the xaml file go to the events panel (lightning bolt) and double click within the textbox of whichever event you would like to create an event handler for. This will automatically generate the event handler and open up the xaml.cs file, where you can add your cs code.