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?
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..
By default styles I mean the default styles that we ship with our controls.
The directory that you can find them in looks something like:
C:\Program Files\Infragistics\NetAdvantage for .NET 2009.1\WPF\DefaultStyles
I will give some thought on that on the weekend and give you a sample/ or at least directions for this.
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 Alex. So far this is exactly what I need. I just have a couple more questions.
1. How do I select a value from code. For example. In My ViewModel I have the value I want to select in the dropdown. What's the best way to do this.
2. I don't have a vertical scroll bar. You said you have this? I get a horizontal one but not a vertical one. Do you have any ideas how I can get one to display. I would think I need to wrap the ComboboxItem in a Scrollviewer but now sure.
Thanks again for the help. This functionality is a big requirement for us.
1) I am not sure if that would work in your MVVM scenario, but you have to go down the element tree to the XamDataGrid and select a record ( the same way I used to go up the tree to set the value of the XamComboEditor when a record is selected in the XamDataGrid.
Something like:
XamDataGrid x = Infragistics.Windows.Utilities.GetDescendantFromType(xamComboEditor1, typeof(XamDataGrid), false) as XamDataGrid;
2) I do not believe that the scrollviewer will help much, because the XamDataGrid would not know when it needs to have a scrollbar because it is inside the DropDown of the XamComboEditor. The quickest way around this is to set the Height property of the XamDataGrid which will bring the vertical scrollbar when needed. Is that acceptable if your scenario?