0

I've got code in WinForms which i need to convert to WPF DevExpress.

I need to create LookUpEdit in code and add it to a created gridColumn.

The code in winforms:

var editor = (RepositoryItemLookUpEdit) gridControl.RepositoryItems.Add("LookUpEdit");

editor.DataSource = CreateList(query);

for (int i = 0; i < ... < ....Count; i++)
                {
                    var columnInfo = new LookUpColumnInfo(parentTableColumns[i].Name)
                        {SortOrder = ColumnSortOrder.Ascending};
                    editor.Columns.Add(columnInfo);
                }

editor.BestFitMode = BestFitMode.BestFitResizePopup;

gridColumn.ColumnEdit = editor;
gridColumn.FilterMode = ColumnFilterMode.DisplayText;

RepositoryItemLookUpEdit, LookUpColumnInfo does not exist in Xpf not winforms, how do i do exact things in DevExpress WPF ?

user975869
  • 275
  • 1
  • 5
  • 12
  • Why do you want to do it like this? Why not specify the column in `XAML`? – Willem Jul 18 '12 at 15:56
  • it is not one column, theres a "for each column" stuff above. its got a model to deal with data you have no knowledge about, and the columns are autogenerated so i cant describe them in xaml. – user975869 Jul 18 '12 at 16:04
  • I don't think it will do what you need. As far as i know, you create a GridControl and you add the GridControl to it's `PopupContentTemplate`. So what i would suggest, is to create a GridControl, Set AutoPopulateColumns="True" and set the ItemSource. Then add the GridControl to your LookupEdit's `PopupContentTemplate` – Willem Jul 18 '12 at 16:17
  • i'm not sure what you mean by addnig gridControl to LookupEdits template. The idea is to have a large grid where some columns might have LookUps in their cells depending on data. I have all the checks of relationships etc, the code part above is only for making a column have LookUp in its cells. Does your solution still count in this case? – user975869 Jul 18 '12 at 16:23
  • dont know why your answer dissapeared Willem, but was giving me this error: 'GridControl' ControlTemplate TargetType does not match templated type 'PopupContentControl' – user975869 Jul 19 '12 at 11:14
  • See my edit: `ControlTemplate template = new ControlTemplate(typeof(PopupContentControl));` – Willem Jul 19 '12 at 11:23

1 Answers1

2

I was searching for almost the same thing and i found this link giving some information about my case . I added a sample project and the Dev express support edit it to help me implement the lookUpEdit in grid Column . the Solution is not perfect yet (for me ) but maybe your case is simpler and this is you solution .

the link to dev express page Grid and LookupEditSettings