簡體   English   中英

在DevExpree TreeList控件中更改TreeListNode索引(位置)

[英]Change TreeListNode Index (Position) in DevExpree TreeList Control

我正在使用DevExpree XtraTreeList控件,我想將第一個級別節點之一隨機設置為Tree中的第一個節點,TreeList控件的“方法”或TreeListNode方法中沒有顯示任何幫助,

請指教。

編輯: 我的代碼

 private void btnSetMaster_ButtonClick(object sender, DevExpress.XtraEditors.Controls.ButtonPressedEventArgs e)
        {
            //Load reprot
            if (treeLstRprtDS.FocusedNode != null)
            {
                treeLstRprtDS.SetNodeIndex(treeLstRprtDS.FocusedNode,0);
                //Get selected underlying object
                ReportDataSource rprtDataSourceSelected =
                    (ReportDataSource)treeLstRprtDS.GetDataRecordByNode(treeLstRprtDS.FocusedNode);
                theReport.SetReportDataSourceAsMaster(rprtDataSourceSelected);
            }
        }

編輯:

注意:在綁定模式下工作


解:

我為XtrTreeList控件實現了CompareNodeValues事件

然后強制使用Column.SortIndex對樹進行排序閱讀此處...

聽起來您正在尋找SetNodeIndex方法

您是否希望滾動TreeList,以便某個節點成為頂部節點? 如果是這樣,請使用TreeList的TopVisibleNodeIndex屬性。 如果需要某個節點作為第一個節點,則應在TreeList的CompareNodeValues事件處理程序中對其進行排序。

暫無
暫無

聲明:本站的技術帖子網頁,遵循CC BY-SA 4.0協議,如果您需要轉載,請注明本站網址或者原文地址。任何問題請咨詢:yoyou2525@163.com.

 
粵ICP備18138465號  © 2020-2024 STACKOOM.COM