Guest User

Untitled

a guest
Sep 4th, 2018
132
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.61 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15.  
  16. namespace TestApp
  17. {
  18. /// <summary>
  19. /// Interaction logic for mainUserControl.xaml
  20. /// </summary>
  21. public partial class mainUserControl : UserControl
  22. {
  23. public mainUserControl(){
  24. InitializeComponent();
  25.  
  26. TextBlock tb = new TextBlock();
  27. tb.Text = "Username :";
  28. tb.Width = 100;
  29. tb.HorizontalAlignment = HorizontalAlignment.Left;
  30. panel1.Children.Add(tb);
  31. TextBox username = new TextBox();
  32. username.Width = 100;
  33. username.HorizontalAlignment = HorizontalAlignment.Left;
  34. panel1.Children.Add(username);
  35.  
  36. TextBlock tb1 = new TextBlock();
  37. tb1.Text = "Full Name :";
  38. tb1.Width = 100;
  39. tb1.HorizontalAlignment = HorizontalAlignment.Left;
  40. panel1.Children.Add(tb1);
  41. TextBox fullname = new TextBox();
  42. fullname.Width = 100;
  43. fullname.HorizontalAlignment = HorizontalAlignment.Left;
  44. panel1.Children.Add(fullname);
  45.  
  46. ComboBox cb = new ComboBox();
  47. cb.Width = 150;
  48. cb.HorizontalAlignment = HorizontalAlignment.Left;
  49. cb.Margin = new Thickness(0, 5, 0, 0);
  50. CustomerData[] customer_list = gd.getCustomerRecord();
  51. cb.Items.Add("Select Gender");
  52. cb.Items.Add("Male");
  53. cb.Items.Add("Female");
  54. cb.Items.Add("Other");
  55. cb.SelectedIndex = 0;
  56. panel1.Children.Add(cb);
  57.  
  58. TextBlock tb2 = new TextBlock();
  59. tb2.Text = "Full Name :";
  60. tb2.Width = 100;
  61. tb2.HorizontalAlignment = HorizontalAlignment.Left;
  62. panel1.Children.Add(tb2);
  63. TextBox password = new TextBox();
  64. password.Width = 100;
  65. password.HorizontalAlignment = HorizontalAlignment.Left;
  66. panel1.Children.Add(password);
  67.  
  68. Button submit = new Button();
  69. submit.Name = "submit_user";
  70. submit.Width = 100;
  71. submit.HorizontalAlignment = HorizontalAlignment.Left;
  72. submit.Content = "Save user Data";
  73. submit.Margin = new Thickness(0, 5, 0, 0);
  74. submit.Click += (s, e) =>
  75. {
  76. //here you can define action for submitting form.
  77. MessageBox.Show("username = " + username.Text);
  78. };
  79. panel1.Children.Add(submit);
  80. }
  81. }
  82. }
Add Comment
Please, Sign In to add comment