Show how to implement a custom ComboBoxEdit with TreeView as a PopupContent and use it inside DXGrid as a custom column.
Update (version 13.1):
We've modified this code example by using the DevExpress control version 13.1. There is no need to create custom classes to resolve this problem.
You can accomplish this task by using the Grid control in the TreeView mode as a popup content template of the LookUpEdit control.
This way is more efficient and clear than the way used in this example for old versions of DevExpress controls.
Here is a snippet of the markup file:
[XAML]<dxg:LookUpEditName="lookUpEdit"VerticalAlignment="Top"Width="350"Margin="50,37,67,0"DisplayMember="Name"><dxg:LookUpEdit.PopupContentTemplate><ControlTemplate><dxg:GridControlx:Name="PART_GridControl"AutoGenerateColumns="AddNew"><dxg:GridControl.Columns><dxg:GridColumnFieldName="Name"Header="Employee Name"/><dxg:GridColumnFieldName="Position"/><dxg:GridColumnFieldName="Department"/></dxg:GridControl.Columns><dxg:GridControl.View><dxg:TreeListViewName="treeListView1"AutoWidth="True"KeyFieldName="ID"ParentFieldName="ParentID"TreeDerivationMode="Selfreference"/></dxg:GridControl.View></dxg:GridControl></ControlTemplate></dxg:LookUpEdit.PopupContentTemplate></dxg:LookUpEdit>
Question Comments
Added By: Rob Hoglund @ CDW at: 6/12/2013 7:48:00 PM
This example doesn't work with version 12.1.6.
Added By: JSB at: 12/18/2013 1:24:24 PMHi,
Thanks for the update, but while using this with the latest version (13.2), i am unable to hide the columns specified via xaml only approach.
As an example in the above code, even after changing the AutoGenerateColumns from "AddNew" to "None" for GridControl and setting dxg:GridColumns (Position and Department) with Visible="None", those columns are still being shown in the TreeView.
But i can hide the columns by implementing AutoGeneratedColumns Event of GridControl and handling it in the code behind by setting those columns' Visible Property to false.
Am i missing something or this is the only way to do it?
Also is there a way to allow selection of only leaves and parent nodes cannot be selected, as it was possible with earlier approach
reference: http://www.devexpress.com/Support/Center/Question/Details/Q511923
Thanks
Added By: Tobias Gaertner at: 6/12/2014 1:30:21 AMIs there a solution available to the questions JSB posted? I'm facing the same problems using DX 14.1
Added By: Alexander Ch (DevExpress Support) at: 6/12/2014 3:55:58 AM Hi Tobias,I see that you've created a separate ticket for this question: T117693 - Implement a custom drop-down editor with TreeView as PopupContent. Let's continue our conversation there.
Thanks,
Alex