private void TitleEditor_TextChanged(object sender, EventArgs e) { TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement; DataRow row = nodeElement.NodeElement.Data.Tag as DataRow; row["Title"] = this.titleEditor.Text; }
private void DateEditor_ValueChanged(object sender, EventArgs e) { TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement; DataRow row = nodeElement.NodeElement.Data.Tag as DataRow; row["Date"] = this.dateEditor.Value; }
private void DropDownList_SelectedValueChanged(object sender, Telerik.WinControls.UI.Data.ValueChangedEventArgs e) { TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement; DataRow row = nodeElement.NodeElement.Data.Tag as DataRow; row["DeliveryType"] = this.dropDownList.SelectedValue; }
public override bool EndEdit() { TreeNodeContentElement nodeElement = this.EditorElement.Parent as TreeNodeContentElement; nodeElement.NodeElement.Data.Image = null; return(base.EndEdit()); }
public override void BeginEdit() { base.BeginEdit(); TreeNodeContentElement nodeElement = this.EditorElement.Parent as TreeNodeContentElement; nodeElement.NodeElement.Data.Image = Properties.Resources.pen; }
protected override void OnLoaded() { base.OnLoaded(); if (this.Children.Contains(this.TextBoxItem)) { this.Children.Remove(this.TextBoxItem); } TreeNodeContentElement nodeElement = this.Parent as TreeNodeContentElement; if (nodeElement.NodeElement.Data != null) { DataRow row = nodeElement.NodeElement.Data.Tag as DataRow; mainContainer.MinSize = new Size(columnWidth * row.Table.Columns.Count, nodeElement.NodeElement.Data.TreeView.ItemHeight); mainContainer.DrawFill = true; mainContainer.GradientStyle = GradientStyles.Solid; mainContainer.BackColor = nodeElement.NodeElement.BackColor; mainContainer.Margin = new Padding(-2, -4, 0, 0); if (headersContainer.Children.Count == 0) { foreach (DataColumn col in row.Table.Columns) { //generate columns LightVisualElement columnHeader = new LightVisualElement(); columnHeader.MinSize = new System.Drawing.Size(columnWidth, 20); columnHeader.StretchHorizontally = true; columnHeader.Text = col.ColumnName; headersContainer.Children.Add(columnHeader); StyleBorder(columnHeader); //generate data cells if (col.ColumnName == "DeliveryType") { this.dropDownList = new RadDropDownListElement(); this.dropDownList.DropDownStyle = RadDropDownStyle.DropDownList; this.dropDownList.MinSize = new System.Drawing.Size(columnWidth, 0); nodeContentContainer.Children.Add(this.dropDownList); this.dropDownList.DataSource = Enum.GetValues(typeof(DeliveryType)); this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged; } else if (col.ColumnName == "Date") { this.dateEditor = new RadDateTimeEditorElement(); this.dateEditor.Format = DateTimePickerFormat.Custom; this.dateEditor.CustomFormat = "dd/MM/yyyy"; this.dateEditor.MinSize = new System.Drawing.Size(columnWidth, 20); nodeContentContainer.Children.Add(this.dateEditor); this.dateEditor.ValueChanged += DateEditor_ValueChanged; } else if (col.ColumnName == "Id") { this.idEditor = new LightVisualElement(); this.idEditor.StretchVertically = true; this.idEditor.MinSize = new System.Drawing.Size(columnWidth, 24); StyleBorder(this.idEditor); nodeContentContainer.Children.Add(this.idEditor); } else if (col.ColumnName == "ParentId") { this.parentIdEditor = new LightVisualElement(); this.parentIdEditor.MinSize = new System.Drawing.Size(columnWidth, 20); this.parentIdEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0); StyleBorder(this.parentIdEditor); nodeContentContainer.Children.Add(this.parentIdEditor); } else if (col.ColumnName == "Title") { this.titleEditor = new RadTextBoxControlElement(); this.titleEditor.Margin = new System.Windows.Forms.Padding(0, -1, 0, 0); StyleBorder(this.titleEditor); this.titleEditor.MinSize = new System.Drawing.Size(columnWidth, 20); nodeContentContainer.Children.Add(this.titleEditor); this.titleEditor.TextChanged += TitleEditor_TextChanged; } } } this.dropDownList.SelectedValueChanged -= DropDownList_SelectedValueChanged; this.dateEditor.ValueChanged -= DateEditor_ValueChanged; this.titleEditor.TextChanged -= TitleEditor_TextChanged; this.idEditor.Text = row["Id"].ToString(); this.parentIdEditor.Text = row["ParentId"].ToString(); this.titleEditor.Text = row["Title"].ToString(); this.dateEditor.Value = (DateTime)row["Date"]; this.dropDownList.SelectedValue = row["DeliveryType"]; this.titleEditor.TextChanged += TitleEditor_TextChanged; this.dateEditor.ValueChanged += DateEditor_ValueChanged; this.dropDownList.SelectedValueChanged += DropDownList_SelectedValueChanged; } }