I have a program on the Windows Forms (VS13). In the code:
using System.Windows;
namespace WF
{
public partial class Form1 : Form
{
private void Window_Loaded(object sender, RoutedEventArgs e)
{
//...
}
}
}
RoutedEventArgs
cannot be found, but it exists in the namespace System.Windows
. What can be reason? I have a reference to the WindowsBase
.
RoutedEventArgs
is a WPF-specific thing. In Winforms, nothing like that exists. You should remove your reference to WindowsBase
ans stick to Winforms specific things.
For instance, the Loaded
event doesn't exists. You must use the Load
event from the Form
object instead. The designer really helps here in adding all the bits of code you need and attaching the event handlers.