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)
439SelectedObject = isurf.GetIDesignerHost().RootComponent
DesignSurfaceExt (8)
DesignSurfaceExt.cs (7)
102if (host.RootComponent is not null) 121Type hostType = host.RootComponent.GetType(); 130pdS?.SetValue(ihost.RootComponent, controlSize); 140pdS?.SetValue(ihost.RootComponent, controlSize); 153return (TControl)ihost.RootComponent; 187((Control)newComp).Parent = host.RootComponent as Control; 212|| host.RootComponent is null
TabOrderHooker.cs (1)
21if (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)
1989if (Site.TryGetService(out IDesignerHost? host) && host.RootComponent is ContainerControl rootControl)
System\Windows\Forms\Control.cs (1)
5250&& 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)
338if (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)
17.Setup(h => h.RootComponent)
System\ComponentModel\Design\ComponentDesignerTests.cs (34)
57.Setup(h => h.RootComponent) 84.Setup(h => h.RootComponent) 107.Setup(h => h.RootComponent) 145.Setup(h => h.RootComponent) 310.Setup(h => h.RootComponent) 321mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 325mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 330mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 340.Setup(h => h.RootComponent) 346mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 350mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 355mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 395.Setup(h => h.RootComponent) 410mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 415mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 421mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 433.Setup(h => h.RootComponent) 439mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 443mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2)); 448mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(3)); 483.Setup(h => h.RootComponent) 795.Setup(h => h.RootComponent) 910.Setup(h => h.RootComponent) 1019.Setup(h => h.RootComponent) 1127.Setup(h => h.RootComponent) 1220.Setup(h => h.RootComponent) 1311.Setup(h => h.RootComponent) 1405.Setup(h => h.RootComponent) 1512.Setup(h => h.RootComponent) 1610.Setup(h => h.RootComponent) 1693.Setup(h => h.RootComponent) 2024.Setup(h => h.RootComponent) 2072.Setup(h => h.RootComponent) 2078.Setup(h => h.RootComponent)
System\ComponentModel\Design\DesignerHostTests.cs (16)
127Assert.Null(host.RootComponent); 282Assert.Same(component1, host.RootComponent); 293Assert.Same(component1, host.RootComponent); 304Assert.Same(component1, host.RootComponent); 315Assert.Same(component1, host.RootComponent); 337Assert.Same(component1, host.RootComponent); 349Assert.Same(component1, host.RootComponent); 360Assert.Same(component1, host.RootComponent); 371Assert.Same(component1, host.RootComponent); 1353Assert.Null(host.RootComponent); 1358Assert.Same(component, host.RootComponent); 1363Assert.Same(component, host.RootComponent); 2227Assert.Null(host.RootComponent); 2535Assert.Null(host.RootComponent); 2547Assert.Null(host.RootComponent); 2559Assert.Null(host.RootComponent);
System\ComponentModel\Design\DesignSurfaceTests.cs (7)
26Assert.Null(surface.Host.RootComponent); 65Assert.Null(surface.Host.RootComponent); 87Assert.IsType<RootDesignerComponent>(surface.Host.RootComponent); 109Assert.IsType<RootDesignerComponent>(surface.Host.RootComponent); 156Assert.IsType<RootDesignerComponent>(surface.Host.RootComponent); 423Assert.Null(host.RootComponent); 935Assert.IsType<RootDesignerComponent>(host.RootComponent);
System\ComponentModel\Design\SiteNestedContainerTests.cs (11)
184Assert.Same(component1, host.RootComponent); 195Assert.Same(component1, host.RootComponent); 206Assert.Same(component1, host.RootComponent); 217Assert.Same(component1, host.RootComponent); 241Assert.Same(component1, host.RootComponent); 253Assert.Same(component1, host.RootComponent); 264Assert.Same(component1, host.RootComponent); 275Assert.Same(component1, host.RootComponent); 677Assert.Null(host.RootComponent); 687Assert.Null(host.RootComponent); 697Assert.Null(host.RootComponent);
TestControlDesigner.Mocks.cs (1)
21.Setup(h => h.RootComponent)
ToolStripDesignerTests.cs (1)
23.Setup(h => h.RootComponent)
ToolStripDropDownDesignerTest.cs (1)
21.Setup(h => h.RootComponent)
ToolStripMenuItemDesignerTest.cs (2)
101.Setup(h => h.RootComponent) 130.Setup(h => h.RootComponent)
System.Windows.Forms.Tests (8)
System\Windows\Forms\ControlTests.Methods.cs (5)
2554.Setup(s => s.RootComponent) 2560.Setup(s => s.RootComponent) 2657.Setup(h => h.RootComponent) 2662mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 2668mockDesignerHost.Verify(h => h.RootComponent, Times.Exactly(2));
System\Windows\Forms\ErrorProviderTests.cs (3)
727.Setup(h => h.RootComponent) 739mockDesignerHost.Verify(h => h.RootComponent, Times.Once()); 743mockDesignerHost.Verify(h => h.RootComponent, Times.Once());