or
public class test
{
public string name { get; set; }
public BindingList<childs
> childlist { get; set; }
}
public class childs
{
public string childname { get; set; }
}
private void form_Load(object sender, EventArgs e)
{
BindingList<
test
> testlist = new BindingList<
test
>();
/** I populate my list with data. I wont show this here. After the list is populated: **//
this.raggrid.MasterTemplate.Columns.Clear();
this.raggrid.MasterTemplate.AutoGenerateColumns = true;
this.raggrid.MasterTemplate.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
this.raggrid.MasterTemplate.Columns.Add(new GridViewTextBoxColumn("name", "name"));
GridViewTemplate template = new GridViewTemplate();
this.raggrid.Templates.Add(template);
template.Columns.Add(new GridViewTextBoxColumn("name", "childname"));
template.AutoSizeColumnsMode = GridViewAutoSizeColumnsMode.Fill;
GridViewRelation relation = new GridViewRelation(this.raggrid.MasterTemplate, template);
relation.ChildColumnNames.Add("childlist");
this.raggrid.Relations.Add(relation);
this.raggrid.DataSource = testlist;
}
{
public
delegate
void
GroupHeaderCellButtonClickEventHandler(
object
sender, GroupHeaderButtonClickEventArgs e);
public
partial
class
CustomGridView : RadGridView
{
public
event
GroupHeaderCellButtonClickEventHandler GroupHeaderCellButtonClick;
public
CustomGridView()
{
InitializeComponent();
base
.CreateCell +=
new
GridViewCreateCellEventHandler(CustomGridView_CreateCell);
}
void
CustomGridView_CreateCell(
object
sender, GridViewCreateCellEventArgs e)
{
if
(e.CellType ==
typeof
(GridGroupContentCellElement) && e.Row.GetType() ==
typeof
(GridGroupHeaderRowElement))
{
e.CellElement =
new
RadCustomGroupContentCell(e.Column, e.Row);
RadCustomGroupContentCell cellElement = (RadCustomGroupContentCell)e.CellElement;
cellElement.InternalGroupHeaderCellButtonClick+=
new
GroupHeaderCellButtonClickEventHandler(cellElement_InternalGroupHeaderCellButtonClick);
}
}
void
cellElement_InternalGroupHeaderCellButtonClick(
object
sender, GroupHeaderButtonClickEventArgs e)
{
if
(GroupHeaderCellButtonClick !=
null
)
{
GroupHeaderCellButtonClick(sender, e);
}
}
public
override
string
ThemeClassName
{
get
{
return
typeof
(RadGridView).FullName;
}
set
{ }
}
protected
internal
class
RadCustomGroupContentCell : GridGroupContentCellElement
{
public
event
GroupHeaderCellButtonClickEventHandler InternalGroupHeaderCellButtonClick;
RadButtonElement theButton;
public
RadCustomGroupContentCell(GridViewColumn column, GridRowElement row)
:
base
(column, row)
{
}
protected
override
void
DisposeManagedResources()
{
theButton.Click -=
new
EventHandler(theButton_Click);
base
.DisposeManagedResources();
}
void
theButton_Click(
object
sender, EventArgs e)
{
InternalGroupHeaderCellButtonClick(sender,
new
GroupHeaderButtonClickEventArgs((GridViewGroupRowInfo)
this
.RowInfo));
}
protected
override
void
CreateChildElements()
{
base
.CreateChildElements();
theButton =
new
RadButtonElement();
theButton.Click +=
new
EventHandler(theButton_Click);
theButton.Text =
"Insert"
;
theButton.TextImageRelation = System.Windows.Forms.TextImageRelation.ImageBeforeText;
theButton.Image = Resources.InsertRow16;
this
.Children.Add(theButton);
}
protected
override
SizeF ArrangeOverride(SizeF finalSize)
{
SizeF size =
base
.ArrangeOverride(finalSize);
float
buttonX =2;
float
buttonY = 4;
RectangleF buttonRectangle =
new
RectangleF(buttonX, buttonY, theButton.DesiredSize.Width + 4, theButton.DesiredSize.Height + 2);
theButton.Arrange(buttonRectangle);
float
buttonAndTextX = theButton.DesiredSize.Width + 4;
RectangleF clientRect =
new
RectangleF(buttonAndTextX + buttonX, 0, finalSize.Width - buttonAndTextX - buttonX, finalSize.Height + 4);
this
.layoutManagerPart.Arrange(clientRect);
return
size;
}
protected
override
Type ThemeEffectiveType
{
get
{
return
typeof
(GridGroupContentCellElement);
}
set
{ }
}
}
}
}
public
class
GroupHeaderButtonClickEventArgs:EventArgs
{
public
GridViewGroupRowInfo GroupRowInfo
{
get
;
set
; }
public
GroupHeaderButtonClickEventArgs(GridViewGroupRowInfo groupRowInfo)
{
this
.GroupRowInfo = groupRowInfo;
}
}
using
System.Collections.Generic;
using
System.Windows.Forms;
using
Telerik.WinControls;
using
Telerik.WinControls.Data;
using
Telerik.WinControls.UI;
namespace
MultiColumnComboAutoSelectWithTab
{
public
class
RandomObject
{
public
int
Id {
get
;
set
; }
public
string
FirstStuff {
get
;
set
; }
public
string
SecondStuff {
get
;
set
; }
public
RandomObject(
int
id,
string
first,
string
second)
{
this
.Id = id;
this
.FirstStuff = first;
this
.SecondStuff = second;
}
}
public
class
Form1 : Form
{
public
Form1()
{
InitializeComponent();
InitializeCustomComponent();
var lst =
new
List<RandomObject>();
lst.Add(
new
RandomObject(1,
"Albert"
,
"Stuff"
));
lst.Add(
new
RandomObject(2,
"Alphonse"
,
"Stuff"
));
this
.radMultiColumnComboBox1.DataSource = lst;
}
private
void
InitializeCustomComponent()
{
this
.radMultiColumnComboBox1.DisplayMember =
"FirstStuff"
;
this
.radMultiColumnComboBox1.ValueMember =
"Id"
;
this
.radMultiColumnComboBox1.EditorControl.Columns.Add(
new
GridViewTextBoxColumn(
"Id"
,
"Id"
));
this
.radMultiColumnComboBox1.EditorControl.Columns[
"Id"
].IsVisible =
false
;
this
.radMultiColumnComboBox1.EditorControl.Columns.Add(
new
GridViewTextBoxColumn(
"FirstStuff"
,
"FirstStuff"
));
this
.radMultiColumnComboBox1.EditorControl.Columns[
"FirstStuff"
].HeaderText =
"First stuff"
;
this
.radMultiColumnComboBox1.EditorControl.Columns.Add(
new
GridViewTextBoxColumn(
"SecondStuff"
,
"SecondStuff"
));
this
.radMultiColumnComboBox1.EditorControl.Columns[
"SecondStuff"
].HeaderText =
"SecondStuff"
;
this
.radMultiColumnComboBox1.AutoFilter =
true
;
this
.radMultiColumnComboBox1.DropDownStyle = RadDropDownStyle.DropDown;
this
.radMultiColumnComboBox1.AutoSize =
true
;
this
.radMultiColumnComboBox1.AutoSizeDropDownToBestFit =
true
;
var filter =
new
FilterDescriptor(
this
.radMultiColumnComboBox1.DisplayMember, FilterOperator.StartsWith,
string
.Empty);
this
.radMultiColumnComboBox1.EditorControl.MasterTemplate.FilterDescriptors.Add(filter);
}
/// <summary>
/// Variable nécessaire au concepteur.
/// </summary>
private
System.ComponentModel.IContainer components =
null
;
/// <summary>
/// Nettoyage des ressources utilisées.
/// </summary>
/// <param name="disposing">true si les ressources managées doivent être supprimées ; sinon, false.</param>
protected
override
void
Dispose(
bool
disposing)
{
if
(disposing && (components !=
null
))
{
components.Dispose();
}
base
.Dispose(disposing);
}
#region AutoGeneratedStuff
private
void
InitializeComponent()
{
this
.radMultiColumnComboBox1 =
new
Telerik.WinControls.UI.RadMultiColumnComboBox();
this
.radTextBox1 =
new
Telerik.WinControls.UI.RadTextBox();
((System.ComponentModel.ISupportInitialize)(
this
.radMultiColumnComboBox1)).BeginInit();
((System.ComponentModel.ISupportInitialize)(
this
.radTextBox1)).BeginInit();
this
.SuspendLayout();
//
// radMultiColumnComboBox1
//
//
// radMultiColumnComboBox1.NestedRadGridView
//
this
.radMultiColumnComboBox1.EditorControl.BackColor = System.Drawing.SystemColors.Window;
this
.radMultiColumnComboBox1.EditorControl.Font =
new
System.Drawing.Font(
"Microsoft Sans Serif"
, 8.25F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((
byte
)(0)));
this
.radMultiColumnComboBox1.EditorControl.ForeColor = System.Drawing.SystemColors.ControlText;
this
.radMultiColumnComboBox1.EditorControl.Location =
new
System.Drawing.Point(0, 0);
//
//
//
this
.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowAddNewRow =
false
;
this
.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowCellContextMenu =
false
;
this
.radMultiColumnComboBox1.EditorControl.MasterTemplate.AllowColumnChooser =
false
;
this
.radMultiColumnComboBox1.EditorControl.MasterTemplate.EnableGrouping =
false
;
this
.radMultiColumnComboBox1.EditorControl.MasterTemplate.ShowFilteringRow =
false
;
this
.radMultiColumnComboBox1.EditorControl.Name =
"NestedRadGridView"
;
this
.radMultiColumnComboBox1.EditorControl.ReadOnly =
true
;
this
.radMultiColumnComboBox1.EditorControl.ShowGroupPanel =
false
;
this
.radMultiColumnComboBox1.EditorControl.Size =
new
System.Drawing.Size(240, 150);
this
.radMultiColumnComboBox1.EditorControl.TabIndex = 0;
this
.radMultiColumnComboBox1.Location =
new
System.Drawing.Point(81, 78);
this
.radMultiColumnComboBox1.Name =
"radMultiColumnComboBox1"
;
//
//
//
this
.radMultiColumnComboBox1.RootElement.AutoSizeMode = Telerik.WinControls.RadAutoSizeMode.WrapAroundChildren;
this
.radMultiColumnComboBox1.Size =
new
System.Drawing.Size(369, 20);
this
.radMultiColumnComboBox1.TabIndex = 0;
this
.radMultiColumnComboBox1.TabStop =
false
;
this
.radMultiColumnComboBox1.Text =
"radMultiColumnComboBox1"
;
//
// radTextBox1
//
this
.radTextBox1.Location =
new
System.Drawing.Point(81, 131);
this
.radTextBox1.Name =
"radTextBox1"
;
this
.radTextBox1.Size =
new
System.Drawing.Size(330, 20);
this
.radTextBox1.TabIndex = 1;
this
.radTextBox1.TabStop =
false
;
this
.radTextBox1.Text =
"radTextBox1"
;
//
// Form1
//
this
.AutoScaleDimensions =
new
System.Drawing.SizeF(6F, 13F);
this
.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
this
.ClientSize =
new
System.Drawing.Size(498, 266);
this
.Controls.Add(
this
.radTextBox1);
this
.Controls.Add(
this
.radMultiColumnComboBox1);
this
.Name =
"Form1"
;
this
.Text =
"Form1"
;
((System.ComponentModel.ISupportInitialize)(
this
.radMultiColumnComboBox1)).EndInit();
((System.ComponentModel.ISupportInitialize)(
this
.radTextBox1)).EndInit();
this
.ResumeLayout(
false
);
this
.PerformLayout();
}
#endregion
private
Telerik.WinControls.UI.RadMultiColumnComboBox radMultiColumnComboBox1;
private
Telerik.WinControls.UI.RadTextBox radTextBox1;
}
}
tvMPWorkspace.TreeViewElement.Update(RadTreeViewElement.UpdateActions.StateChanged);
if
(rDockModelPackage.DocumentManager.ActiveDocument !=
null
&& ((RadCustomDocumentWindow)rDockModelPackage.DocumentManager.ActiveDocument).DocumentNode == e.Node)
{
e.NodeElement.BackColor = Color.PaleGoldenrod;
}
else
{
e.NodeElement.ResetValue(LightVisualElement.BackColorProperty, Telerik.WinControls.ValueResetFlags.Local);
}