public void UpdateXLocationPropertyGridHost(bool isRight) { //To update the selected controls while using the arrow keys to move the selected controls ISelectionService selectionService = (ISelectionService)(ActiveDesignSurface.GetService(typeof(ISelectionService))); ICollection iControls = selectionService.GetSelectedComponents(); Array arr = Array.CreateInstance(typeof(object), iControls.Count); iControls.CopyTo(arr, 0);//copying the iControls into the arrary for (int i = iControls.Count - 1; i >= 0; i--) { this.PropertyGridHost.SelectedObject = arr.GetValue(i); this.PropertyGridHost.UpdateXValue(isRight); } selectionService.SetSelectedComponents(iControls); }
void PropertyGridHost_invokeUpdate() { IDesignerHost host = (IDesignerHost)ActiveDesignSurface.GetService(typeof(IDesignerHost)); if (null == host) { return; } if (null == host.RootComponent) { return; } ISelectionService selectionService = (ISelectionService)(ActiveDesignSurface.GetService(typeof(ISelectionService))); object oldSelectedObj = PropertyGridHost.SelectedObject;; //SelectedObject = host.RootComponent; //SelectedObject = oldSelectedObj ; List <object> li = new List <object>(); li.Add(host.RootComponent); //li.Add(oldSelectedObj); ICollection i1 = li; selectionService.SetSelectedComponents(i1); if (null != selectionService) { ICollection i = selectionService.GetSelectedComponents(); selectionService.SetSelectedComponents(i); } li = new List <object>(); li.Add(oldSelectedObj); i1 = li; selectionService.SetSelectedComponents(i1); if (null != selectionService) { ICollection i = selectionService.GetSelectedComponents(); selectionService.SetSelectedComponents(i); } UpdateValueChanged(); updateStatusBar(this.PropertyGridHost.reportCtrlProp.reportControlProperty); }
public void UpdatePropertyGridHost(DesignSurfaceExt2 surface) { IDesignerHost host = (IDesignerHost)surface.GetService(typeof(IDesignerHost)); if (null == host) { return; } if (null == host.RootComponent) { return; } //- sync the PropertyGridHost if (host.TransactionDescription == null) { return; } string[] transactionArr = host.TransactionDescription.Split(' '); ISelectionService selectionService = (ISelectionService)(ActiveDesignSurface.GetService(typeof(ISelectionService))); ICollection i = selectionService.GetSelectedComponents(); //if (transactionArr[0] == "Move" || transactionArr[0] == "Resize") if (transactionArr[0] != "Move" && transactionArr[0] != "Resize") { //if (transactionArr[0] == "Delete") //{ // this.PropertyGridHost.DeleteReportControlPropertyItem(); //} this.PropertyGridHost.SelectedObject = host.RootComponent; } else { this.PropertyGridHost.SelectedObject = this.PropertyGridHost.SelectedObject; updateStatusBar(this.PropertyGridHost.reportCtrlProp.reportControlProperty); } }