Skip to content

Instantly share code, notes, and snippets.

@lazzyms
Last active September 4, 2018 10:35
Show Gist options
  • Save lazzyms/a5008edf7782490dda69237b0bf8756c to your computer and use it in GitHub Desktop.
Save lazzyms/a5008edf7782490dda69237b0bf8756c to your computer and use it in GitHub Desktop.
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 TestApp
{
/// <summary>
/// Interaction logic for mainUserControl.xaml
/// </summary>
public partial class mainUserControl : UserControl
{
public mainUserControl(){
InitializeComponent();
TextBlock tb = new TextBlock();
tb.Text = "Username :";
tb.Width = 100;
tb.HorizontalAlignment = HorizontalAlignment.Left;
panel1.Children.Add(tb);
TextBox username = new TextBox();
username.Width = 100;
username.HorizontalAlignment = HorizontalAlignment.Left;
panel1.Children.Add(username);
TextBlock tb1 = new TextBlock();
tb1.Text = "Full Name :";
tb1.Width = 100;
tb1.HorizontalAlignment = HorizontalAlignment.Left;
panel1.Children.Add(tb1);
TextBox fullname = new TextBox();
fullname.Width = 100;
fullname.HorizontalAlignment = HorizontalAlignment.Left;
panel1.Children.Add(fullname);
ComboBox cb = new ComboBox();
cb.Width = 150;
cb.HorizontalAlignment = HorizontalAlignment.Left;
cb.Margin = new Thickness(0, 5, 0, 0);
CustomerData[] customer_list = gd.getCustomerRecord();
cb.Items.Add("Select Gender");
cb.Items.Add("Male");
cb.Items.Add("Female");
cb.Items.Add("Other");
cb.SelectedIndex = 0;
panel1.Children.Add(cb);
TextBlock tb2 = new TextBlock();
tb2.Text = "Full Name :";
tb2.Width = 100;
tb2.HorizontalAlignment = HorizontalAlignment.Left;
panel1.Children.Add(tb2);
TextBox password = new TextBox();
password.Width = 100;
password.HorizontalAlignment = HorizontalAlignment.Left;
panel1.Children.Add(password);
Button submit = new Button();
submit.Name = "submit_user";
submit.Width = 100;
submit.HorizontalAlignment = HorizontalAlignment.Left;
submit.Content = "Save user Data";
submit.Margin = new Thickness(0, 5, 0, 0);
submit.Click += (s, e) =>
{
//here you can define action for submitting form.
MessageBox.Show("username = " + username.Text);
};
panel1.Children.Add(submit);
}
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment