Hi Telerik
I am building a multicolumn dropdown list in which I wish to use grouping. The grid has three columns, SecurityType, InstrumentGroup and Instrument. I want to group on SecurityType and within that grouping by InstrumentGroup so as to create a little hierarchy to act as a visual aid in selection.
If I allow manual grouping and drag the required columns to the group panel everything works fine but if I attempt to achieve the grouping programmaically the group header text for the InstrumentGroup header shows the same text as the SecurityType header.
I have attached the relevant snippet in the hope that you will have some insight into this one. Please note the commented out code was left in so you could see the other method I tried.
Regards
Ian Carson
Grid is setup like so..
Data is entered using this method and for testing there is only a single row as follows:
SecurityType="Forex", InstrumentGroup="EUR", Instrument="EUR/USD"
I am building a multicolumn dropdown list in which I wish to use grouping. The grid has three columns, SecurityType, InstrumentGroup and Instrument. I want to group on SecurityType and within that grouping by InstrumentGroup so as to create a little hierarchy to act as a visual aid in selection.
If I allow manual grouping and drag the required columns to the group panel everything works fine but if I attempt to achieve the grouping programmaically the group header text for the InstrumentGroup header shows the same text as the SecurityType header.
I have attached the relevant snippet in the hope that you will have some insight into this one. Please note the commented out code was left in so you could see the other method I tried.
Regards
Ian Carson
Grid is setup like so..
private
void
GenerateMComboGrids()
{
mcboInstrument.AutoSizeDropDownToBestFit =
true
;
mcboInstrumentComboElement = mcboInstrument.MultiColumnComboBoxElement;
mcboInstrumentComboElement.MultiColumnPopupForm.DropDownAnimationDirection = RadDirection.Left | RadDirection.Down;
mcboInstrumentComboElement.DropDownSizingMode = SizingMode.UpDownAndRightBottom;
mcboInstrumentComboElement.DropDownHeight = 100;
mcboInstrumentComboElement.DropDownStyle = Telerik.WinControls.RadDropDownStyle.DropDown;
mcboInstrumentComboElement.EditorControl.MasterTemplate.AutoGenerateColumns =
false
;
mcboInstrumentComboElement.EditorControl.ShowGroupedColumns =
false
;
mcboInstrumentComboElement.EditorControl.ShowRowHeaderColumn =
false
;
mcboInstrumentComboElement.EditorControl.EnableGrouping =
true
;
mcboInstrumentComboElement.EditorControl.AutoExpandGroups =
true
;
mcboInstrumentComboElement.EditorControl.ShowGroupPanel =
false
;
mcboInstrumentComboElement.RightToLeft =
true
;
GridViewTextBoxColumn column =
new
GridViewTextBoxColumn(
"SecurityType"
);
column.HeaderText =
"Security Type"
;
mcboInstrumentComboElement.EditorControl.Columns.Add(column);
GridViewTextBoxColumn column2 =
new
GridViewTextBoxColumn(
"InstrumentGroup"
);
column2.HeaderText =
"Instrument Group"
;
mcboInstrumentComboElement.EditorControl.Columns.Add(column2);
GridViewTextBoxColumn column3 =
new
GridViewTextBoxColumn(
"Instrument"
);
column3.HeaderText =
"Instrument"
;
mcboInstrumentComboElement.EditorControl.Columns.Add(column3);
mcboInstrumentComboElement.EditorControl.GroupDescriptors.Expression =
"SecurityType ASC; InstrumentGroup ASC"
;
//GroupDescriptor descriptor = new GroupDescriptor();
//descriptor.GroupNames.Add("SecurityType", ListSortDirection.Ascending);
//GroupDescriptor descriptor2 = new GroupDescriptor();
//descriptor2.GroupNames.Add("InstrumentGroup", ListSortDirection.Ascending);
//mcboInstrumentComboElement.EditorControl.GroupDescriptors.Add(descriptor);
//mcboInstrumentComboElement.EditorControl.GroupDescriptors.Add(descriptor2);
//mcboInstrumentComboElement.EditorControl.GroupSummaryEvaluate += new GroupSummaryEvaluateEventHandler(EditorControl_GroupSummaryEvaluate);
}
Data is entered using this method and for testing there is only a single row as follows:
SecurityType="Forex", InstrumentGroup="EUR", Instrument="EUR/USD"
private
void
PopulateInstrumentList()
{
StrategyDistinctInstruments instruments =
new
StrategyDistinctInstruments(ThisVariation.StrategyVariation);
Dictionary<
string
, BacktestInstrument> uniqueInstruments = instruments.UniqueInstruments;
mcboInstrumentComboElement.EditorControl.TableElement.BeginUpdate();
foreach
(KeyValuePair<
string
, BacktestInstrument> kvp
in
uniqueInstruments)
{
GridViewRowInfo rowInfo = mcboInstrumentComboElement.EditorControl.Rows.AddNew();
rowInfo.Tag = kvp.Value.Inst;
rowInfo.Cells[0].Value = kvp.Value.SecurityType;
rowInfo.Cells[1].Value = kvp.Value.InstrumentGroup;
rowInfo.Cells[2].Value = kvp.Value.Inst.Name;
}
mcboInstrumentComboElement.EditorControl.TableElement.EndUpdate(
true
);
}