C# WPF Tutorial for beginner : how to create simple application WPF Desktop Application Windows Presentation Foundation using C# programming language
C# WPF Tutorial - create simple application using WPF (Windows Presentation Foundation) in C# programming language, In addition to vb.net, C# also can handle WPF (Windows Presentation Foundation) to create beauty Desktop applications.
Please Read :
Click on Visual C# -> Select Windows -> Verify target framework version -> Select WPF Application -> Specify project Name, Location -> Click on OK.
Change window title either from Properties window or XAML Editor. You can see a reflection in Designer view. There are lots of properties available to change design of the window according to our requirements.
Click on Toolbox, Several controls are available in toolbox like Button, CheckBox, ComboBox, etc. You can simply design your surface by Click and drag a control from the Toolbox to the design surface. Click and drag Button control to the design surface.
Now Run the application by clicking on Start Debugging (F5) button.
Please Read :
XAML (Extensible Application Markup Language)
WPF uses XAML to represent the UI and user interaction. XAML is constructed from XML and writing similar to XHTML frequently you use in creating web-based applications. XAML also supports the principles of the code-behind as in the application ASP.NET. By using XAML, designers and programmers can work together in developing applications, first create the UI design designer then programmer continue by adding the code in a language that is supported by such C #/.NET and VB.NET.Create C# WPF Application
Open your visual studio and please create New WPF application. Click File menu > New Project.Click on Visual C# -> Select Windows -> Verify target framework version -> Select WPF Application -> Specify project Name, Location -> Click on OK.
Change window title either from Properties window or XAML Editor. You can see a reflection in Designer view. There are lots of properties available to change design of the window according to our requirements.
Click on Toolbox, Several controls are available in toolbox like Button, CheckBox, ComboBox, etc. You can simply design your surface by Click and drag a control from the Toolbox to the design surface. Click and drag Button control to the design surface.
Source Code C# WPF Application
Double Click On the Button1 and write this source code
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
namespace C_WPFapplication {
///
/// Interaction logic for MainWindow.xaml
///
public partial class MainWindow : Window {
public MainWindow() {
InitializeComponent();
}
private void button_Click(object sender, RoutedEventArgs e) {
MessageBox.Show("Hello World!", "www.hc-kr.com");
}
}
}
Now Run the application by clicking on Start Debugging (F5) button.
COMMENTS