void gridView1_RowClick(object sender, DevExpress.XtraGrid.Views.Grid.RowClickEventArgs e) { ComponentObject obj = (ComponentObject)this.gridView1.GetRow(this.gridView1.FocusedRowHandle); if (obj != null) { HostSurface surface = (HostSurface)Studio.SurfaceManager.ActiveDesignSurface; surface.ServiceSelection.SetSelectedComponents(new Component[] { (Component)obj.Component }); } }
public void RefreshList( ) { DataList.Clear(); HostSurface surface = (HostSurface)Studio.SurfaceManager.ActiveDesignSurface; if (surface == null) { return; } foreach (IComponent comp in surface.DesignerHost.Container.Components) { ComponentObject obj = new ComponentObject(comp.Site.Name, comp.GetType().Name); obj.Component = comp; DataList.Add(obj); } this.gridControl1.DataSource = DataList; this.gridControl1.RefreshDataSource(); this.gridView1.OptionsBehavior.Editable = false; this.gridView1.OptionsSelection.EnableAppearanceFocusedCell = false; this.gridView1.RowClick += new DevExpress.XtraGrid.Views.Grid.RowClickEventHandler(gridView1_RowClick); this.gridView1.CustomDrawCell += new DevExpress.XtraGrid.Views.Base.RowCellCustomDrawEventHandler(gridView1_CustomDrawCell); }