To get started, make sure you have Visual Studio 2005 and these extensions.
Download details: The Visual Studio 2005 extensions for.NET Framework 3.0 (WCF & WPF), November 2006 CTP
Download details: Visual Studio 2005 extensions for .NET Framework 3.0 (Windows Workflow Foundation)
First, I created a new project of type Windows Application under .NET Framework 3.0 category. I named it "HelloWPF".
I then designed the form. The Visual Studio's WPF designer is seperated into 2 panes : one for the visual designer and the other for editing raw XAML code. You can click on the "swap" button to swap the XAML pane and visual designer pane too. However, this CTP version of designer is hard to use and is not very impressive.
After that, I tried to add an event handler to the click event of the button. But there is no same old "Events" tab in the property window. Double clicked the button in the designer also not work. It takes me some time to figured out that I has to map event to code in XAML or to map it in the code under the constructor. I choose the latter way. Here is my C# code.
public partial class Window1 : System.Windows.Window
{
public Window1()
{
InitializeComponent();
btnSayHello.Click +=
new RoutedEventHandler(btnSayHello_Click);
}
void btnSayHello_Click(object sender,
RoutedEventArgs e)
{
txtMessage.Text = "WPF : สวัสดี ว่าไง";
}
}
I could finally press the F5 button and this is the result.
1 comment:
You need a faster connection to keep up with your Internet's demands and with HughesNet, you will be able to count on a fast internet connection that's always ready for your help. If you are dealing with technical problems related to HughesNet, just go with HughesNet Support Phone Number and resolve all queries instantly. Our 24*7 toll-free helpline is always open to assist you without any interruption.
Post a Comment