Advertisement
Guest User

Untitled

a guest
Feb 3rd, 2017
126
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.63 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Windows.Forms;
  5.  
  6. namespace ObjectModel
  7. {
  8. public partial class Form1 : Form
  9. {
  10. public Form1()
  11. {
  12. InitializeComponent();
  13. ultraGrid1.MouseClick += UltraGrid1OnMouseClick;
  14. }
  15.  
  16. private void UltraGrid1OnMouseClick(object sender, MouseEventArgs mouseEventArgs)
  17. {
  18. if (mouseEventArgs.Button == MouseButtons.Right)
  19. ultraGrid1.ShowColumnChooser();
  20. }
  21.  
  22. private void Form1_Load(object sender, EventArgs e)
  23. {
  24. List<Parent> parents = new List<Parent>();
  25. parents.Add(new Parent());
  26. parents.Add(new Parent());
  27. parents.Add(new Parent());
  28.  
  29. ultraGrid1.DataSource = parents;
  30. }
  31. }
  32.  
  33. [DisplayName("ParentDisplayName")]
  34. public class Parent
  35. {
  36. private List<Child> children = new List<Child>();
  37.  
  38. public Parent()
  39. {
  40. children.Add(new Child());
  41. children.Add(new Child());
  42. }
  43. [Browsable(true)]
  44. public IEnumerable<Child> Children { get { return children; } }
  45.  
  46. public int ParentValueBrowsable { get; }
  47.  
  48. [Browsable(false)]
  49. public int ParentValueNotBrowsable { get; }
  50. }
  51.  
  52. public class Child
  53. {
  54. [Browsable(false)]
  55. public Parent Parent { get; }
  56.  
  57. [Browsable(false)]
  58. public int ChildValueNotBrowsable{ get; }
  59. [Browsable(true)]
  60. public int ChildValueBrowsable { get; }
  61. }
  62. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement