In Microsoft Visual Studio Open menu File -> Project
Select “WPF Browser Application” Click “OK” Button
Here we have one textbox and Button
Page1.xaml
<Page x:Class="FirstExample.Page1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="Page1">
<Grid>
<StackPanel>
<TextBox Margin="103,30,102,35" Name="txtName" Width="100">TextBox>
<Button Margin="103,50,112,145" Name="button1" Click="button1_Click" Width="100">Click Me..Button>
</StackPanel>
</Grid>
</Page>
Page1.xaml.cs
namespace FirstExample
{
public partial class Page1 : Page
{
public Page1()
{
InitializeComponent();}
private void button1_Click(object sender, RoutedEventArgs e)
{
MessageBox.Show("Hello "+txtName.Text);}
}
}
Output
Download
Comments
Post a Comment