1. 程式人生 > >Dev_GridView:使用PopupContainerControl實現下拉樹形列表

Dev_GridView:使用PopupContainerControl實現下拉樹形列表

要使用 DevExpress 實現下拉列表樹,需要使用三個控制元件結合才可以實現

PopupContainerEdit、PopupContainerControl、TreeList

設定控制元件 PopupContainerEdit 屬性

PopupControl 設定要繫結到 PopupContainerEdit 控制元件中的 PopupContainerControl

設定控制元件 TreeList 屬性

Dock 設定 TreeList  在控制元件 PopupContainerControl 中的填充方式

 

OptionsBehavior   

// 設定選中的節點是否可以編輯

Editable = False

 

OptionsSelection 

// 返回或設定是否允許使用者可以對活動單元的外觀進行調整

EnableAppearanceFocusedCell = False

 

OptionsView 

// 設定是否顯示列頭

ShowColumns = False

// 設定使用者是否可以對行或列進行調整 

ShowIndicator = False

 

ListView 事件 FocusedNodeChanged 獲取節點值

TreeListNode node = e.Node

popupContainerEdit.Tag = node["xx"].ToString();

popupContainerEdit.EditValue = node[0].ToString();

popupContainerEdit.ClosePopup();

 

//設定在顯示控制元件 PopupContainerControl 時和控制元件 PopupContainerEdit  寬度保持一致

PopupContainerEdit 事件 QueryPopUp 

PopupContainerEdit popupedit = (PopupContainerEdit)sender;

popupContainer.Width = popupedit.Width;
---------------------

轉載自:https://blog.csdn.net/haoqingbin_1125/article/details/19807483