or
public partial class Form1 : Form { private BindingList<Node> AllNodes = new BindingList<Node>(); public Form1() { InitializeComponent(); } private void Form1_Load(object sender, EventArgs e) { LoadData(); } public void LoadData() { LoadAllNodes(); grid.DataSource = AllNodes; LoadAllObjectColumns(grid.MasterTemplate); // Load child template GridViewTemplate template = new GridViewTemplate(); LoadAllObjectColumns(template); grid.MasterTemplate.Templates.Add(template); GridViewRelation r = new GridViewRelation(grid.MasterTemplate, template); r.ChildColumnNames.Add("Children"); grid.Relations.Add(r); } public void LoadAllNodes() { Node p1 = new Node("Parent 1", ItemStatus.None); Node n1 = new Node("Child 1", ItemStatus.None); Node n2 = new Node("Child 2", ItemStatus.None); p1.Children.Add(n1); p1.Children.Add(n2); AllNodes.Add(p1); Node p2 = new Node("Parent 2", ItemStatus.None); AllNodes.Add(p2); } public static void LoadAllObjectColumns(GridViewTemplate template) { template.Columns.Clear(); template.EnableFiltering = true; template.AllowAddNewRow = false; template.AutoGenerateColumns = false; GridViewTextBoxColumn colName = new GridViewTextBoxColumn("Name"); colName.HeaderText = "Name"; colName.Name = "Name"; template.Columns.Add(colName); GridViewComboBoxColumn colStatus = new GridViewComboBoxColumn("Status"); colStatus.HeaderText = "Status"; colStatus.Name = "Status"; colStatus.DataSource = Enum.GetValues(typeof(ItemStatus)).Cast<ItemStatus>(); template.Columns.Add(colStatus); template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill; } public enum ItemStatus { None, New, Test, Complete }; public class Node : INotifyPropertyChanged { public event PropertyChangedEventHandler PropertyChanged; protected void NotifyPropertyChanged(String info) { if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(info)); } } private string name; private ItemStatus status; private BindingList<Node> children; public string Name { get { return name; } set { if (name != value) { name = value; NotifyPropertyChanged("Name"); } } } public ItemStatus Status { get { return status; } set { if (status != value) { status = value; NotifyPropertyChanged("Status"); } } } public BindingList<Node> Children { get { return children; } set { children = value; } } public Node(string name, ItemStatus status) { this.name = name; this.status = status; children = new BindingList<Node>(); } } }
class TextureConverter : ResourceConverter { public override StandardValuesCollection GetStandardValues(ITypeDescriptorContext context) { Type[] tType = new Type[] { typeof(Texture), typeof(TextureAtlas) }; string[] tResource = ProjectManager.Singleton.CurrentProject.GetResourceNameListForType(tType, false); return new StandardValuesCollection(tResource); } }[Category("Settings Sprite")] [DisplayName("Texture")] [Description("Current Texture")] [TypeConverter(typeof(TextureConverter))] public virtual string Texture { get { return mTextureCBValues; } set { if (mTextureCBValues != value) { if (value == "") { ResetTexture(); } else { Item tTex = ProjectManager.Singleton.CurrentProject.GetResourceByName(value, true, Name); if (tTex is Texture) { mTextureCBValues = value; SetTexture(tTex as Texture); } else if (tTex is TextureAtlas) { mTextureCBValues = value; SetTextureAtlas(tTex as TextureAtlas); } else { SetStatus(Item.StatusState.ERROR, "Texture " + value + " is not found or invalid"); ResetTexture(); } } Refresh(); NotifyPropertyChanged(); } } }deleted wrong forum
protected override void CreateChildElements() { base.CreateChildElements(); this.stackLayout = new StackLayoutPanel(); this.stackLayout.Orientation = Orientation.Horizontal; this.contentElement = new LightVisualElement(); this.contentElement.StretchHorizontally = true; this.contentElement.MinSize = new Size(220, 2200); this.stackLayout.Children.Add(this.contentElement); imageElement = new clsBackDropItem(null,160,106); imageElement.ImageLayout = System.Windows.Forms.ImageLayout.Center; this.stackLayout.Children.Add(this.imageElement); this.buttonElement2 = new RadButtonElement(); this.buttonElement2.Text = "Button2"; this.stackLayout.Children.Add(this.buttonElement2); this.dd=new RadDropDownList(); this.stackLayout.Children.Add(this.dd); this.Children.Add(this.stackLayout);string sort = this.myRadGridView.SortDescriptors.Expression;Console.WriteLine(sort);string filter = this.myRadGridView.FilterDescriptors.Expression;Console.WriteLine(filter);Unit ID ASC([Unit ID] = 1)