1 implementation of RootComponent
System.Windows.Forms.Design (1)
System\ComponentModel\Design\DesignerHost.cs (1)
873IComponent IDesignerHost.RootComponent => _rootComponent!;
206 references to RootComponent
DesignSurface (1)
MainForm.cs (1)
447SelectedObject = isurf.GetIDesignerHost().RootComponent
DesignSurfaceExt (8)
DesignSurfaceExt.cs (7)
95if (host.RootComponent is not null) 114Type hostType = host.RootComponent.GetType(); 123pdS?.SetValue(ihost.RootComponent, controlSize); 133pdS?.SetValue(ihost.RootComponent, controlSize); 146return (TControl)ihost.RootComponent; 180((Control)newComp).Parent = host.RootComponent as Control; 205|| host.RootComponent is null
TabOrderHooker.cs (1)
18if (host.RootComponent is null)
System.ComponentModel.TypeConverter (1)
System\Timers\Timer.cs (1)
223object? baseComponent = host?.RootComponent;
System.Windows.Forms (4)
System\Windows\Forms\ActiveX\AxHost.cs (1)
1990if (Site.TryGetService(out IDesignerHost? host) && host.RootComponent is ContainerControl rootControl)
System\Windows\Forms\Control.cs (1)
5289&& host.RootComponent == this))
System\Windows\Forms\Controls\WebBrowser\WebBrowserBase.cs (1)
1140if (Site.TryGetService(out IDesignerHost? host) && host.RootComponent is ContainerControl rootContainerControl)
System\Windows\Forms\ErrorProvider\ErrorProvider.cs (1)
100if (host.RootComponent is ContainerControl rootContainer)
System.Windows.Forms.Design (110)
System\ComponentModel\Design\ComponentDesigner.cs (5)
82IComponent? root = GetService<IDesignerHost>()?.RootComponent; 368return TryGetService(out IDesignerHost? host) && _component == host.RootComponent; 383bool isRoot = TryGetService(out IDesignerHost? host) && component == host.RootComponent; 473IComponent? rootComponent = GetService<IDesignerHost>()?.RootComponent; 497IComponent? rootComponent = GetService<IDesignerHost>()?.RootComponent;
System\ComponentModel\Design\DesignSurface.cs (2)
130IComponent? rootComponent = ((IDesignerHost)_host).RootComponent; 443IComponent? rootComponent = ((IDesignerHost)_host).RootComponent;
System\ComponentModel\Design\MenuCommandService.cs (1)
202useGlobalVerbs = (selectedComponent == designerHost.RootComponent);
System\ComponentModel\Design\SelectionService.cs (1)
223if (GetService(typeof(IDesignerHost)) is IDesignerHost host && _selection.Contains(host.RootComponent))
System\ComponentModel\Design\Serialization\BasicDesignerLoader.cs (2)
301if (host?.RootComponent is not null) 640lh2.CanReloadWithErrors = LoaderHost.RootComponent is not null;
System\ComponentModel\Design\Serialization\CodeDomDesignerLoader.cs (4)
798Debug.Assert(_rootSerializer is not null || _typeSerializer is not null, $"What are we saving right now? Base component has no serializer: {LoaderHost.RootComponent.GetType().FullName}"); 802typeDeclaration = _rootSerializer.Serialize(manager, LoaderHost.RootComponent) as CodeTypeDeclaration; 807typeDeclaration = _typeSerializer.Serialize(manager, LoaderHost.RootComponent, LoaderHost.Container.Components); 853if (LoaderHost.RootComponent == component)
System\ComponentModel\Design\Serialization\CodeDomDesignerLoader.ModifiersExtenderProvider.cs (1)
53return _host?.RootComponent;
System\ComponentModel\Design\Serialization\CodeDomDesignerLoader.ModifiersInheritedExtenderProvider.cs (1)
60return _host?.RootComponent;
System\ComponentModel\Design\Serialization\CodeDomLocalizationProvider.LanguageExtenders.cs (3)
73if (_host is not null && _host.RootComponent != _lastRoot) 75_lastRoot = _host.RootComponent; 225return (_host is not null && o == _host.RootComponent);
System\ComponentModel\Design\ToolStripContainerActionList.cs (4)
100=> _designerHost?.RootComponent is Control root 116if (_designerHost.RootComponent is Control root && _toolStripContainer.Parent is null) 135if (_designerHost?.RootComponent is not Control root 327string displayName = _designerHost?.RootComponent is UserControl
System\Windows\Forms\Design\BaseContextMenuStrip.cs (1)
85IComponent root = host.RootComponent;
System\Windows\Forms\Design\Behavior\DragAssistanceManager.cs (1)
531Control rootControl = (Control)host.RootComponent;
System\Windows\Forms\Design\Behavior\SelectionManager.cs (1)
59_rootComponent = (Control)_designerHost.RootComponent;
System\Windows\Forms\Design\Behavior\ToolboxItemSnapLineBehavior.cs (1)
347Control baseControl = host.RootComponent as Control;
System\Windows\Forms\Design\ChangeToolStripParentVerb.cs (1)
41Control root = _host.RootComponent as Control;
System\Windows\Forms\Design\CommandSet.cs (17)
603IComponent currentSnapComponent = host.RootComponent; 1140if (host.RootComponent is Control baseComponent) 1487if (obj == host.RootComponent || obj is not Control c) 1512if (obj == host.RootComponent || obj is not IComponent component) 1562SelectionService.SetSelectedComponents(new object[] { host.RootComponent }, SelectionTypes.Replace); 1642if (obj == host.RootComponent) 1807SelectionService.SetSelectedComponents(new object[] { host.RootComponent }, SelectionTypes.Replace); 1814SelectionService.SetSelectedComponents(new object[] { host.RootComponent }, SelectionTypes.Replace); 1913IComponent baseComponent = host.RootComponent; 2216IComponent baseComp = host.RootComponent; 2252IComponent baseComponent = host.RootComponent; 2401IComponent baseComponent = host.RootComponent; 2485IComponent baseComponent = host.RootComponent; 2538IComponent baseComponent = host.RootComponent; 2906object baseComponent = designerHost.RootComponent; 2999object baseComp = host.RootComponent; 3343IComponent? baseComponent = host?.RootComponent;
System\Windows\Forms\Design\ComponentTray.cs (3)
1079IDesigner designer = host.GetDesigner(host.RootComponent); 1696if (host is not null && host.RootComponent is not null) 1698if (host.GetDesigner(host.RootComponent) is IRootDesigner rd)
System\Windows\Forms\Design\ControlCodeDomSerializer.cs (4)
181if (TypeDescriptorHelper.TryGetPropertyValue(host.RootComponent, "Localizable", out bool b) && b) 193if ((host is not null && control == host.RootComponent) || HasSitedNonReadonlyChildren(control)) 228if (control == host.RootComponent) 284if (parent == host.RootComponent)
System\Windows\Forms\Design\ControlCommandSet.cs (10)
281Control comp = host.RootComponent as Control; 402currentSnapComponent ??= host.RootComponent; 945object baseComp = host.RootComponent; 1255&& host.RootComponent is Control baseComponent 1272&& host.RootComponent is Control baseComponent 1297object baseComp = host.RootComponent; 1370if (selSvc is null || host is null || !(host.RootComponent is Control)) 1385current = (Control)host.RootComponent; 1437if (selSvc is null || host is null || !(host.RootComponent is Control)) 1442baseCtl = (Control)host.RootComponent;
System\Windows\Forms\Design\ControlDesigner.cs (7)
217if (AutoResizeHandles && Component != _host?.RootComponent) 375return TryGetService(out IDesignerHost? host) && Component == host.RootComponent; 688if (parent is not null && _host is not null && _host.RootComponent != Component) 972&& _host.RootComponent != component 981if ((_host is null || _host.RootComponent != component) && ForceVisible) 2172if (_host is not null && _host.RootComponent is not null && _host.GetDesigner(_host.RootComponent) is IRootDesigner rd)
System\Windows\Forms\Design\DataGridViewColumnDesigner.cs (1)
288return _initializing ? (Component != host.RootComponent) // for non root components, respect the name that the base Control serialized unless changed
System\Windows\Forms\Design\DesignBindingPicker.cs (3)
529if (_designerHost is not null && _designerHost.RootComponent is not null && _designerHost.RootComponent.Site is not null) 531_instancesNode = new InstancesNode(_designerHost?.RootComponent.Site.Name);
System\Windows\Forms\Design\DesignerExtenders.NameExtenderProvider.cs (1)
37_baseComponent = host.RootComponent;
System\Windows\Forms\Design\DocumentDesigner.cs (1)
859if (host.RootComponent is Control root)
System\Windows\Forms\Design\OleDragDropHandler.cs (2)
169if (host is not null && CurrentlyLocalizing(host.RootComponent)) 668IContainer? container = host.RootComponent.Site!.Container;
System\Windows\Forms\Design\ParentControlDesigner.cs (4)
548Control rootControl = host.RootComponent as Control; 1001if (parent is not null && host is not null && host.RootComponent != Component) 1494DocumentDesigner parentDesigner = host.GetDesigner(host.RootComponent) as DocumentDesigner; 1677if (host?.GetDesigner(host.RootComponent) is DocumentDesigner parentDesigner)
System\Windows\Forms\Design\SelectionUIHandler.cs (1)
308if (controls[i] == host.RootComponent)
System\Windows\Forms\Design\TableLayoutPanelCodeDomSerializer.cs (1)
71if (TypeDescriptorHelper.TryGetPropertyValue(host.RootComponent, "Localizable", out bool b))
System\Windows\Forms\Design\TableLayoutPanelDesigner.cs (2)
96PropertyDescriptor prop = TypeDescriptor.GetProperties(host.RootComponent)["Localizable"]; 99return (bool)prop.GetValue(host.RootComponent);
System\Windows\Forms\Design\TabOrder.cs (4)
238Control baseControl = (Control)_host.RootComponent; 296Control rootControl = (Control)_host.RootComponent; 658GetTabbing((Control)_host.RootComponent, _tabControls); 728Control form = (Control)_host.RootComponent;
System\Windows\Forms\Design\ToolStripContainerDesigner.cs (1)
329if ((component == _designerHost.RootComponent) || !glyphBounds.IntersectsWith(controlBounds))
System\Windows\Forms\Design\ToolStripDesigner.cs (1)
1474Form parentForm = _host.RootComponent as Form;
System\Windows\Forms\Design\ToolStripDropDownDesigner.cs (5)
168IComponent rootComponent = _host.RootComponent; 270if (_host.RootComponent is Control form) 301if (_host.RootComponent is not Control) 372_selectionService.SetSelectedComponents(new IComponent[] { _host.RootComponent }, SelectionTypes.Replace); 389if (_host.RootComponent is Control form)
System\Windows\Forms\Design\ToolStripItemDesigner.cs (2)
252IComponent root = designerHost.RootComponent; 433if (designerHost.RootComponent is Control parent)
System\Windows\Forms\Design\ToolStripKeyboardHandlingService.cs (7)
1066selSvc.SetSelectedComponents(new object[] { Host.RootComponent }, SelectionTypes.Replace); 1189|| host.RootComponent is not Control) 1304|| host.RootComponent is not Control) 1673if (selSvc is null || host is null || !(host.RootComponent is Control)) 1695current = (Control)host.RootComponent; 1764if (selSvc is null || host is null || !(host.RootComponent is Control)) 1770baseCtl = (Control)host.RootComponent;
System\Windows\Forms\Design\ToolStripMenuItemDesigner.cs (2)
1131if (_designerHost.GetDesigner(_designerHost.RootComponent) is ControlDesigner designer) 1199if (_designerHost.GetDesigner(_designerHost.RootComponent) is ControlDesigner designer)
System\Windows\Forms\Design\ToolStripTemplateNode.cs (2)
915baseComponent = (Control)_designerHost.RootComponent; 995Control baseComponent = (Control)_designerHost.RootComponent;
System.Windows.Forms.Design.Tests (74)
SplitContainerDesignerTests.cs (1)
19.Setup(h => h.RootComponent)
System\ComponentModel\Design\ComponentDesignerTests.cs (34)
59.Setup(h => h.RootComponent) 86.Setup(h => h.RootComponent) 109.Setup(h => h.RootComponent) 147.Setup(h => h.RootComponent) 312.Setup(h => h.RootComponent) 323mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 327mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 332mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 342.Setup(h => h.RootComponent) 348mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 352mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 357mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 397.Setup(h => h.RootComponent) 412mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 417mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 423mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 435.Setup(h => h.RootComponent) 441mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 445mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 450mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 485.Setup(h => h.RootComponent) 797.Setup(h => h.RootComponent) 912.Setup(h => h.RootComponent) 1021.Setup(h => h.RootComponent) 1129.Setup(h => h.RootComponent) 1222.Setup(h => h.RootComponent) 1313.Setup(h => h.RootComponent) 1407.Setup(h => h.RootComponent) 1514.Setup(h => h.RootComponent) 1612.Setup(h => h.RootComponent) 1695.Setup(h => h.RootComponent) 2026.Setup(h => h.RootComponent) 2074.Setup(h => h.RootComponent) 2080.Setup(h => h.RootComponent)
System\ComponentModel\Design\DesignerHostTests.cs (16)
129Assert.Null(host.RootComponent); 284Assert.Same(component1, host.RootComponent); 295Assert.Same(component1, host.RootComponent); 306Assert.Same(component1, host.RootComponent); 317Assert.Same(component1, host.RootComponent); 339Assert.Same(component1, host.RootComponent); 351Assert.Same(component1, host.RootComponent); 362Assert.Same(component1, host.RootComponent); 373Assert.Same(component1, host.RootComponent); 1355Assert.Null(host.RootComponent); 1360Assert.Same(component, host.RootComponent); 1365Assert.Same(component, host.RootComponent); 2229Assert.Null(host.RootComponent); 2537Assert.Null(host.RootComponent); 2549Assert.Null(host.RootComponent); 2561Assert.Null(host.RootComponent);
System\ComponentModel\Design\DesignSurfaceTests.cs (7)
28Assert.Null(surface.Host.RootComponent); 67Assert.Null(surface.Host.RootComponent); 89Assert.IsType<RootDesignerComponent>(surface.Host.RootComponent); 111Assert.IsType<RootDesignerComponent>(surface.Host.RootComponent); 158Assert.IsType<RootDesignerComponent>(surface.Host.RootComponent); 425Assert.Null(host.RootComponent); 937Assert.IsType<RootDesignerComponent>(host.RootComponent);
System\ComponentModel\Design\SiteNestedContainerTests.cs (11)
186Assert.Same(component1, host.RootComponent); 197Assert.Same(component1, host.RootComponent); 208Assert.Same(component1, host.RootComponent); 219Assert.Same(component1, host.RootComponent); 243Assert.Same(component1, host.RootComponent); 255Assert.Same(component1, host.RootComponent); 266Assert.Same(component1, host.RootComponent); 277Assert.Same(component1, host.RootComponent); 679Assert.Null(host.RootComponent); 689Assert.Null(host.RootComponent); 699Assert.Null(host.RootComponent);
TestControlDesigner.Mocks.cs (1)
19.Setup(h => h.RootComponent)
ToolStripDesignerTests.cs (1)
25.Setup(h => h.RootComponent)
ToolStripDropDownDesignerTest.cs (1)
23.Setup(h => h.RootComponent)
ToolStripMenuItemDesignerTest.cs (2)
103.Setup(h => h.RootComponent) 132.Setup(h => h.RootComponent)
System.Windows.Forms.Tests (8)
System\Windows\Forms\ControlTests.Methods.cs (5)
2523.Setup(s => s.RootComponent) 2529.Setup(s => s.RootComponent) 2626.Setup(h => h.RootComponent) 2631mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 2637mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2));
System\Windows\Forms\ErrorProviderTests.cs (3)
729.Setup(h => h.RootComponent) 741mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 745mockDesignerHost.Verify(h => h.RootComponent, Times.Once());