dev 控件中点击TreeList节点高亮显示GridControl中存在的行

        private void treeListDs_FocusedNodeChanged(object sender, FocusedNodeChangedEventArgs e)
        {
            treeListDsNode = e.Node;
            string v = e.Node.GetValue("GROUP_RULE").ToString();
            DataTable dtGroups = gridLookUpEdit1.Properties.DataSource as DataTable;
            foreach(DataRow dr in dtGroups.Rows)
            {
                if (dr["RULE_GROUP"].ToString().Equals(v))
                    gridLookUpEdit1.EditValue = v;
            }
            gridViewGroupRule.Focus();
            gridViewGroupRule.LayoutChanged();
            //gridControlGroupRule.Focus();
        }
        private void GridViewGroupRule_RowStyle(object sender, RowStyleEventArgs e)
        {
            try
            {
                GridView View = sender as GridView;
                if (e.RowHandle >= 0)
                {
                    string category = View.GetRowCellDisplayText(e.RowHandle, View.Columns["RULE_CODE"]);
                    string v = treeListDsNode.GetValue("GROUP_RULE").ToString();
                    if (category == v)
                    {
                        e.Appearance.BackColor = Color.Salmon;
                        e.Appearance.BackColor2 = Color.SeaShell;
                        // 高优先级
                        e.HighPriority = true;
                        // 默认开启
                        // gridViewGroupRule.OptionsBehavior.SmartVertScrollBar = true;
                    }
                }
            }
            catch(Exception ex)
            {
                XtraMessageBox.Show(ex.Message);
            }
        }
原文地址:https://www.cnblogs.com/jsersudo/p/14022776.html