Advertisement
Guest User

das

a guest
Jun 23rd, 2018
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.34 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Threading.Tasks;
  7. using System.Windows;
  8. using System.Windows.Controls;
  9. using System.Windows.Data;
  10. using System.Windows.Documents;
  11. using System.Windows.Input;
  12. using System.Windows.Media;
  13. using System.Windows.Media.Imaging;
  14. using System.Windows.Navigation;
  15. using System.Windows.Shapes;
  16.  
  17. namespace WpfApp1
  18. {
  19. /// <summary>
  20. /// Interaction logic for MainWindow.xaml
  21. /// </summary>
  22. public partial class MainWindow : Window
  23. {
  24. public MainWindow()
  25. {
  26. InitializeComponent();
  27.  
  28. DataContext = new Person();
  29. }
  30. }
  31.  
  32. class Person : IDataErrorInfo
  33. {
  34. public string FirstName { get; set; }
  35. public string LastName { get; set; }
  36. public string Email { get; set; }
  37. public string this[string columnName]
  38. {
  39. get
  40. {
  41. if(columnName == nameof(FirstName))
  42. {
  43. if(string.IsNullOrWhiteSpace(FirstName))
  44. {
  45. return "Pole imie jest wymagane";
  46. }
  47. }
  48.  
  49. return string.Empty;
  50. }
  51. }
  52.  
  53. public string Error { get; }
  54. }
  55. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement