Hi. In the winforms version of your combobox there is a nice feature to be able to bind a dataset to the combobox to show a grid in the drop down. Is this available in the XamComboEditor. If not any ideas how to set this up?
Hello,
Basically, the XamComboEditor does not support this, but you could retemplate the ComboBoxDataItem's template and put a XamDataGrid inside, so that you can bind to a Collection,DataTable,etc.
<igEditors:XamComboEditor Name="xamComboEditor1">
<igEditors:XamComboEditor.Resources>
<DataTemplate DataType="{x:Type igEditors:ComboBoxDataItem}" >
<Grid>
<igDP:XamDataGrid x:Name="TextBlock" DataSource="{Binding Path=Value}" />
</Grid>
</DataTemplate>
</igEditors:XamComboEditor.Resources>
</igEditors:XamComboEditor>
Then create ComboBoxItemsProvider and add a ComboBoxDataItem, which Value property you can set to a DataTable,Collection,etc. Add the ComboBoxDataItem in the ComboBoxItemsProvider and set the ItemsProvider property of the XamComboEditor.
string[] values = new string[] { "value1", "value2", "value3" };ComboBoxDataItem cb = new ComboBoxDataItem();cb.Value = values;ComboBoxItemsProvider c = new ComboBoxItemsProvider();c.Items.Add(cb); xamComboEditor1.ItemsProvider = c;
Hope this helps.
Hey Alex. This is what I needed, thanks. Question. When I click the drop down it takes a second or two to actually drop down the grid. Does rendering the grid take that long? Do you have that problem? Thanks for your help on this..
@ 1) I have the scrollbar, I am not sure why you do not see it. If you have a sample application, please attach it to your next post.
@ 2) Using this approach, this would not be possible, because we retemplated the ComboBoxDataItem, and this would be the selected item (a XamDataGrid).
I suggest using the Default styles for the XamComboEditor, that we ship in the DefaultStyles directory in the Infragistics folder on your computer and retemplating the XamComboEditor's template.
Hi Alex. If I can't template the closed drop down to show a specific column then I'll have to take your suggestion and write a template for Combobox. I'm not sure what you mean by use the default style from XamComboEditor? Can you provide a sample? This is what I need to figure out. I guess I should have said in my first post. It doesn't need to be a grid in the combobox it just should "look" like a grid if possible.
Ideally what I would like is a combobox with say 3 columns in each comboboxitem. When I click one "row" it shows perhaps column 2. And when loading when I set the value from say column 1 it selects the correct row. Ideally it would have an aero theme/style to it. Then the last thing would be to somehow create or show a header "row" for each column at the top. I'm guessing that it isn't easy to put in the header column so for that I may need a workaround.
Thanks again for all your help..
So, as I promised.
Having in mind that you want to keep functionality such as theming, styling, I think it is best to stick with the XamDataGrid inside the XamComboEditor. Looking again at the scenario, one grid would suffice - this means one ComboBoxDataItem inside the ComboBoxItemsProvider, which Value would be the DataSource of the XamDataGrid.
The XamComboEditor has one XamDataGrid with several records. The CellClickAction is set to SelectRecord and when a record is selected, SelectedItemChanging event of the grid fires, and we set the Value of the XamComboEditor to this record's cell of choice (in my example index: [0]) and end its edit mode.
We have to use a converter(IValueConverter) for the DisplayText property, because we have retemplated the ComboBoxDataItem and we do not want the whole grid to appear as SelectedItem.
Regarding the headers, I suppose the labels of the grid is what you want to achieve.
I am attaching the sample and please do not hesitate to let me know if you have questions on this.
Hi,
When I use the sample and use the grouping on the grid, the rentire grid shows up in the selected item.
How do I prevent the entire grid showing up in the selected item and at the same time also keep the grouping in the grid?
Thanks
HI,
I am attaching a new sample that prevents the XamDataGrid from being the SelectedItem when Grouped.
I also made the change to keep the groupby intact between dropdowns.
Sincerely,
Matt
Developer Support Engineer
Please let me know if you need further assistance regarding this issue.
I think we should simplify the approach.
I am attaching a new sample using a XamDataGrid inside an Expander.
MattDeveloper Support Engineer
Hi Matt,
We would like your help on other issues listed below.
1> Group by State is not retained once pop up is closed. How to set the default Group by & Auto Expand All Rows when Grid is initialized first time.
2> If we set the XamDataGrid Height to 200, it shows vertical scroll bar. When we adjust width or height using Resize Indicator, Grid is not resizing. If we dont set the grid height, then the vertical scroll bar is not showing. How do we get the vertical scroll bar and resize ability?
3> When we have CellClickAction="EnterEditModeIfAllowed", we can select multiple cells, but we are unable to have multiple rows selected. How do we get cell edit ability and also multi row selection? This would be useful for our users.
4> Clicking on any record and pressing Enter key selects entire Grid and sets as Selected Item of Combo Box and also puts it into the Combo Box dropdown/editable area. How can we fix it?
5> Difference between XamCombo Editor in InfragisticsWPF4.Controls.Editors.XamComboEditor.v12.2 and XamComboEditor in InfragisticsWPF4.Editors.v12.2. Current Given Sample uses former one. We notice major differences in both controls. e.g. Former Control doesn’t have “Empty Text” Property. How to set the Empty Text Property.
Sean
Please let me know if you need further assistance regarding this issue?
I am attaching a new sample.
I made the grid extend the full length of the combo.
I made it so that the DropDown stay open when grouping.
Please review the new sample.