Hi Jep,
I do not quite understand this issue. You can embed the TreeList control into the detail band of the report via an instance of the WinControlContainer class. Can you please describe the problem you are trying to resolve in this manner in greater detail? I will try to prepare an example, according to your requirements.
Thanks,
Elliot
Hi Elliot,
I tried the examples in your site and its working in 9.3. But when I used 10.2. the PrintingSystem.PreviewExForm.BindingContext becomes unidentified.
below is the actual beforeprint event handler:
DataTable dtTemp = new DataTable();
dtTemp.Columns.Add("id", typeof(int));
dtTemp.Columns.Add("ParentId", typeof(int));
dtTemp.Columns.Add("code", typeof(string));
dtTemp.Columns.Add("name", typeof(string));
dtTemp.Columns.Add("type", typeof(string));
dtTemp.Columns.Add("sac", typeof(string));
for (int i = 0; i < 10; i++)
{
string j = i.ToString();
dtTemp.Rows.Add(i, 0, "code" + j, "name" + j, "type" + j, "sac" + j);
}
TreeList tree = new DevExpress.XtraTreeList.TreeList();
tree.ParentChanged += new EventHandler(tree_ParentChanged);
tree.BeginUpdate();
TreeListColumn colCode = new TreeListColumn() { FieldName = "code", Caption = "code" };
TreeListColumn colName = new TreeListColumn() { FieldName = "name", Caption = "name" };
TreeListColumn colType = new TreeListColumn() { FieldName = "type", Caption = "type" };
TreeListColumn colSA = new TreeListColumn() { FieldName = "sac", Caption = "sac" };
tree.Columns.AddRange(new TreeListColumn[] { colCode, colName, colType, colSA });
WinControlContainer wcc = new WinControlContainer();
Detail.Controls.Add(wcc);
wcc.WinControl = tree;
tree.KeyFieldName = "id";
tree.ParentFieldName = "ParentId";
tree.DataSource = dtTemp;
//tree.BindingContext = PrintingSystem.PreviewFormEx.BindingContext;
tree.EndUpdate();
notice that I have to comment out the BindingContext property. In the 9.3, if this is commented out, the TreeList is also not showing.
Thanks in advance.
Jep
Hi Jep,
Thank you for your feedback. Please note that you should set the Parent property for a TreeList to avoid this problem. Please refer to the code below:
[C#]Form form = new Form(); TreeList tree = new DevExpress.XtraTreeList.TreeList(); tree.Parent = form; ...
We look forward to your feedback once you have had the opportunity to try this approach.
Thanks,
Sergi
Hi Jep,
Thank you for your feedback. Attached is a sample project, illustrating how you can show the XtraTreeList within the XtraReport. Please review it and let us know whether or not this information helps you.
Thanks,
Sergi
Hi Sergi,
Thanks for the sample but I need to create the treelist on runtime. also the sample you've provided is not working(pls. see attached screenshot)
regards,
jep
Hi Jep,
Thank you for your feedback. I have modified my previous sample project according to your requirements. Please find it in the attachment. Please let us know whether or not the problem still persists.
Thanks,
Sergi
Is your intention to post an answer to your own question?
- If so, then proceed.
- If you simply wanted to post additional information, ask for further clarification, or to just say "Thanks!", please click Leave a Comment.
- If you wish to edit your original question, please use the Edit button in the Toolbox at the top right corner of that entry.
Facebook
Twitter
Google+