XAML Code :
<Window x:Class="simple_sample_App.MainWindow"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
Title="MainWindow" Height="350" Width="525">
<Grid>
<Label Content="Name"
HorizontalAlignment="Left" Margin="157,56,0,0" VerticalAlignment="Top"/>
<Label Content="Location"
HorizontalAlignment="Left" Margin="157,87,0,0" VerticalAlignment="Top"/>
<TextBox x:Name="txtName"
HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Margin="233,58,0,0" Width="120"/>
<TextBox x:Name="txtLocation"
HorizontalAlignment="Left" TextWrapping="Wrap" VerticalAlignment="Top" Margin="233,89,0,0" Width="120"/>
<Button x:Name="btnSubmit" Content="Submit"
HorizontalAlignment="Left" Margin="233,126,0,0" VerticalAlignment="Top" Width="75" Click="btnSubmit_Click"/>
<Label Content="Name"
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="157,211,0,0"/>
<Label Content="Location"
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="157,242,0,0"/>
<Label x:Name="lblName" Content="Label"
HorizontalAlignment="Left" VerticalAlignment="Top" Margin="233,211,0,0"/>
<Label x:Name="lblLocation"
Content="Label" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="233,242,0,0"/>
<Label Content="Result :"
HorizontalAlignment="Left" Margin="157,180,0,0" VerticalAlignment="Top"/>
<Label Content="WPF Sample Application" HorizontalAlignment="Left" VerticalAlignment="Top" Margin="157,10,0,0" FontFamily="Arial
Black" FontSize="16"/>
</Grid>
</Window>
XAML.CS 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 simple_sample_App
{
/// <summary>
/// Interaction logic for MainWindow.xaml
/// </summary>
public partial class MainWindow : Window
{
public MainWindow()
{
InitializeComponent();
}
private void btnSubmit_Click(object sender, RoutedEventArgs e)
{
lblName.Content = txtName.Text;
lblLocation.Content =
txtLocation.Text;
}
}
}
OutPut :
No comments:
Post a Comment