This is a migrated thread and some comments may be shown as answers.

Group Header text problem

1 Answer 71 Views
MultiColumn ComboBox
This is a migrated thread and some comments may be shown as answers.
Ian
Top achievements
Rank 1
Ian asked on 05 Dec 2011, 02:32 PM
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..

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);
      
}




 

1 Answer, 1 is accepted

Sort by
0
Julian Benkov
Telerik team
answered on 08 Dec 2011, 10:09 AM
Hello Ian,

Please send me screenshots of the different results that come from the manual UI input on one hand and the API grouping operation on the other hand. This will help me provide you with further assiatance. Thank you for your cooperation.

Best wishes,
Julian Benkov
the Telerik team

Q3’11 of RadControls for WinForms is available for download (see what's new). Get it today.

Tags
MultiColumn ComboBox
Asked by
Ian
Top achievements
Rank 1
Answers by
Julian Benkov
Telerik team
Share this question
or