1 implementation of Container
System.Windows.Forms.Design (1)
System\ComponentModel\Design\DesignerHost.cs (1)
871
IContainer IDesignerHost.
Container
=> this;
241 references to Container
System.Windows.Forms.Design (50)
System\ComponentModel\Design\DesignSurface.cs (1)
76
return ((IDesignerHost)_host).
Container
;
System\ComponentModel\Design\Serialization\CodeDomDesignerLoader.cs (4)
807
typeDeclaration = _typeSerializer.Serialize(manager, LoaderHost.RootComponent, LoaderHost.
Container
.Components);
980
return css.Deserialize(data, LoaderHost.
Container
);
1161
if (Modified && LoaderHost.
Container
.Components[name] is not null)
1254
if (!dup && Modified && LoaderHost.
Container
.Components[name] is not null)
System\ComponentModel\Design\Serialization\DesignerSerializationManager.cs (2)
70
_container = host.
Container
;
261
if (GetService(typeof(IDesignerHost)) is IDesignerHost host && host.
Container
== Container)
System\ComponentModel\Design\UndoEngine.cs (2)
442
if (Enabled && _host is not null && _host.
Container
is not null && ComponentChangeService is not null)
445
foreach (IComponent comp in _host.
Container
.Components)
System\ComponentModel\Design\UndoEngine.UndoUnit.AddRemoveUndoEvent.cs (2)
78
engine._serializationService.DeserializeTo(_serializedData, host.
Container
);
86
IComponent? component = host.
Container
.Components[_componentName];
System\ComponentModel\Design\UndoEngine.UndoUnit.ChangeUndoEvent.cs (2)
119
component = host.
Container
.Components[_componentName];
160
engine._serializationService.DeserializeTo(_before, host.
Container
);
System\ComponentModel\Design\UndoEngine.UndoUnit.RenameUndoEvent.cs (1)
29
IComponent? comp = engine._host.
Container
.Components[_after];
System\Windows\Forms\Design\Behavior\BehaviorService.cs (1)
796
foreach (Component comp in host.
Container
.Components)
System\Windows\Forms\Design\Behavior\DragAssistanceManager.cs (1)
586
foreach (IComponent comp in host.
Container
.Components)
System\Windows\Forms\Design\Behavior\DropSourceBehavior.cs (1)
225
_destHost.
Container
.Add(c);
System\Windows\Forms\Design\BindingNavigatorDesigner.cs (1)
104
host?.
Container
.Add(item, DesignerUtils.GetUniqueSiteName(host, item.Name));
System\Windows\Forms\Design\CommandSet.cs (4)
2206
ComponentCollection components = host.
Container
.Components;
3007
if (obj is IComponent { Site: { } objSite } && objSite.Container == host.
Container
)
3056
if (obj is IComponent comp && (comp.Site is null || comp.Site.Container != host.
Container
))
3130
cmd.Enabled = host.
Container
.Components.Count > 1;
System\Windows\Forms\Design\ComponentTray.cs (3)
518
if (host is not null && host.
Container
is not null)
520
if (host.
Container
.Components[name] is not null)
525
host.
Container
.Add(component, name);
System\Windows\Forms\Design\ControlCodeDomSerializer.cs (1)
234
foreach (IComponent component in host.
Container
.Components)
System\Windows\Forms\Design\ControlCommandSet.cs (3)
854
ComponentCollection components = host.
Container
.Components;
1296
ComponentCollection comps = host.
Container
.Components;
1375
IContainer container = host.
Container
;
System\Windows\Forms\Design\DataGridViewAddColumnDialog.cs (3)
156
IContainer? container = host?.
Container
;
637
container = host.
Container
;
771
IContainer? container = host?.
Container
;
System\Windows\Forms\Design\DataGridViewColumnDesigner.cs (1)
58
IContainer? container = host?.
Container
;
System\Windows\Forms\Design\DataGridViewDesigner.cs (1)
673
host?.
Container
.Add(dataGridViewColumn, nameFromText);
System\Windows\Forms\Design\DesignBindingPicker.cs (3)
596
container = _designerHost.
Container
;
1287
_designerHost.
Container
.Add(bs, uniqueSiteName);
1427
IContainer? container = _designerHost?.
Container
;
System\Windows\Forms\Design\DesignerUtils.cs (1)
633
object? existingComponent = host.
Container
.Components[name];
System\Windows\Forms\Design\DocumentDesigner.cs (1)
842
IContainer container = host.
Container
;
System\Windows\Forms\Design\StandardMenuStripVerb.cs (4)
115
while (_host.
Container
.Components[name] is not null)
289
while (_host.
Container
.Components[name] is not null)
494
object existingComponent = _host.
Container
.Components[baseName];
501
return nameCreationService.CreateName(_host.
Container
, itemType);
System\Windows\Forms\Design\ToolStripInSituService.cs (1)
232
ComponentCollection comps = _designerHost.
Container
.Components;
System\Windows\Forms\Design\ToolStripItemDesigner.cs (3)
809
serializationService.DeserializeTo(serializedData, host.
Container
, false, true);
811
newItem = (ToolStripItem)host.
Container
.Components[name];
885
host.
Container
.Add(ToolStripItem);
System\Windows\Forms\Design\ToolStripKeyboardHandlingService.cs (3)
456
ComponentCollection comps = _designerHost.
Container
.Components;
1678
IContainer container = host.
Container
;
1769
IContainer container = host.
Container
;
System.Windows.Forms.Design.Tests (186)
System\ComponentModel\Design\DesignerHostTests.cs (173)
36
Assert.Same(host, host.
Container
);
279
host.
Container
.Add(component1);
280
Assert.Same(component1, Assert.Single(host.
Container
.Components));
290
host.
Container
.Add(component2);
291
Assert.Equal(new IComponent[] { component1, component2 }, host.
Container
.Components.Cast<IComponent>());
301
host.
Container
.Add(component3);
302
Assert.Equal(new IComponent[] { component1, component2, component3 }, host.
Container
.Components.Cast<IComponent>());
312
host.
Container
.Add(component4);
313
Assert.Equal(new IComponent[] { component1, component2, component3, component4 }, host.
Container
.Components.Cast<IComponent>());
334
host.
Container
.Add(component1, "name1");
335
Assert.Same(component1, Assert.Single(host.
Container
.Components));
345
host.
Container
.Add(component2, "name2");
346
Assert.Equal(new IComponent[] { component1, component2 }, host.
Container
.Components.Cast<IComponent>());
356
host.
Container
.Add(component3, string.Empty);
357
Assert.Equal(new IComponent[] { component1, component2, component3 }, host.
Container
.Components.Cast<IComponent>());
367
host.
Container
.Add(component4, null);
368
Assert.Equal(new IComponent[] { component1, component2, component3, component4 }, host.
Container
.Components.Cast<IComponent>());
428
host.
Container
.Add(component);
429
Assert.Same(component, Assert.Single(host.
Container
.Components));
435
host.
Container
.Add(component);
436
Assert.Same(component, Assert.Single(host.
Container
.Components));
442
host.
Container
.Add(component, "name");
443
Assert.Same(component, Assert.Single(host.
Container
.Components));
498
host.
Container
.Add(component);
499
Assert.Same(component, Assert.Single(host.
Container
.Components));
505
host.
Container
.Add(component);
506
Assert.Same(component, Assert.Single(host.
Container
.Components));
512
host.
Container
.Add(component, "name");
513
Assert.Same(component, Assert.Single(host.
Container
.Components));
571
host.
Container
.Add(component);
572
Assert.Same(component, Assert.Single(host.
Container
.Components));
584
host.
Container
.Add(component);
585
Assert.Same(component, Assert.Single(host.
Container
.Components));
596
host.
Container
.Add(component);
597
Assert.Same(component, Assert.Single(host.
Container
.Components));
601
host.
Container
.Add(component);
602
Assert.Same(component, Assert.Single(host.
Container
.Components));
606
host.
Container
.Add(component, "name");
607
Assert.Same(component, Assert.Single(host.
Container
.Components));
637
host.
Container
.Add(component);
639
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
641
host.
Container
.Add(component, null);
643
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
692
host.
Container
.Add(component);
694
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
696
host.
Container
.Add(component, null);
698
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
727
host.
Container
.Add(component1, name);
734
host.
Container
.Add(component2, "name2");
787
host.
Container
.Add(component1, "name1");
798
host.
Container
.Add(component2, "name2");
834
host.
Container
.Add(component, "name1");
878
host.
Container
.Add(component, "name1");
892
host.
Container
.Add(component);
897
Assert.Throws<Exception>(() => host.
Container
.Add(newComponent));
913
host.
Container
.Add(component);
926
host.
Container
.Add(component);
945
host.
Container
.Add(component);
957
host.
Container
.Add(component);
975
host.
Container
.Add(component);
987
host.
Container
.Add(component);
1005
host.
Container
.Add(component);
1041
host.
Container
.Add(component);
1068
host.
Container
.Add(component);
1101
host.
Container
.Add(component);
1131
host.
Container
.Add(component);
1165
host.
Container
.Add(component);
1203
host.
Container
.Add(component);
1238
host.
Container
.Add(component);
1267
host.
Container
.Add(component, oldName);
1284
host.
Container
.Add(component, "name");
1302
host.
Container
.Add(component1);
1303
host.
Container
.Add(component2, null);
1304
host.
Container
.Add(component3, "name3");
1355
host.
Container
.Add(component, oldName);
1385
host.
Container
.Add(component, "oldName");
1434
host.
Container
.Add(component, "oldName");
1450
host.
Container
.Add(component1, "name1");
1451
host.
Container
.Add(component2, "name2");
1477
host.
Container
.Add(component);
1502
host.
Container
.Add(component);
1515
host.
Container
.Add(component);
1549
host.
Container
.Add(component);
1562
host.
Container
.Add(component);
1572
host.
Container
.Add(component);
1582
host.
Container
.Add(component);
1592
host.
Container
.Add(component);
1623
host.
Container
.Add(component);
1624
Assert.Same(host.
Container
, component.Container);
1629
host.
Container
.Add(component);
1630
Assert.Same(host.
Container
, component.Container);
1637
host.
Container
.Add(component);
1638
Assert.Same(host.
Container
, component.Container);
1655
Assert.Throws<NotImplementedException>(() => host.
Container
.Add(component));
1656
Assert.Throws<NotImplementedException>(() => host.
Container
.Add(component, "name"));
1657
Assert.Empty(host.
Container
.Components);
1666
host.
Container
.Add(component, component.GetType().FullName);
1668
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(component));
1669
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(new RootDesignerComponent(), host.RootComponentClassName));
1678
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(component));
1679
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(component, "name"));
1688
Assert.Throws<DivideByZeroException>(() => host.
Container
.Add(component));
1692
Assert.Throws<DivideByZeroException>(() => host.
Container
.Add(component, "name"));
1707
host.
Container
.Add(component);
1715
Assert.Same(host.
Container
, component.Container);
1718
host.
Container
.Add(component, "name");
1719
Assert.Same(host.
Container
, component.Container);
1811
host.
Container
.Add(component);
1826
host.
Container
.Add(component);
2253
host.
Container
.Add(component);
2531
host.
Container
.Add(rootComponent);
2532
host.
Container
.Add(component);
2533
host.
Container
.Remove(rootComponent);
2534
Assert.Same(component, Assert.Single(host.
Container
.Components));
2541
Assert.Same(host.
Container
, component.Container);
2545
host.
Container
.Remove(rootComponent);
2546
Assert.Same(component, Assert.Single(host.
Container
.Components));
2553
Assert.Same(host.
Container
, component.Container);
2557
host.
Container
.Remove(component);
2558
Assert.Empty(host.
Container
.Components);
2619
host.
Container
.Add(component);
2620
Assert.Same(component, Assert.Single(host.
Container
.Components));
2625
host.
Container
.Remove(component);
2626
Assert.Empty(host.
Container
.Components);
2632
host.
Container
.Remove(component);
2633
Assert.Empty(host.
Container
.Components);
2688
host.
Container
.Add(component);
2689
Assert.Same(component, Assert.Single(host.
Container
.Components));
2695
host.
Container
.Remove(component);
2696
Assert.Empty(host.
Container
.Components);
2702
host.
Container
.Remove(component);
2703
Assert.Empty(host.
Container
.Components);
2718
host.
Container
.Add(component);
2719
Assert.Same(component, Assert.Single(host.
Container
.Components));
2722
host.
Container
.Remove(component);
2723
Assert.Empty(host.
Container
.Components);
2735
host.
Container
.Add(component);
2736
Assert.Same(component, Assert.Single(host.
Container
.Components));
2739
host.
Container
.Remove(component);
2740
Assert.Empty(host.
Container
.Components);
2754
host1.
Container
.Add(otherComponent);
2755
host2.
Container
.Add(component);
2756
host2.
Container
.Remove(otherComponent);
2757
host2.
Container
.Remove(new Component());
2758
Assert.Same(otherComponent, Assert.Single(host1.
Container
.Components));
2759
Assert.Same(component, Assert.Single(host2.
Container
.Components));
2771
host1.
Container
.Add(otherComponent);
2772
host2.
Container
.Remove(otherComponent);
2773
host2.
Container
.Remove(new Component());
2774
Assert.Same(otherComponent, Assert.Single(host1.
Container
.Components));
2775
Assert.Empty(host2.
Container
.Components);
2808
host.
Container
.Add(component1);
2809
host.
Container
.Add(component2);
2812
host.
Container
.Remove(component1);
2815
Assert.Same(host.
Container
, component2.Container);
2817
Assert.Same(component2, Assert.Single(host.
Container
.Components));
2822
host.
Container
.Remove(component1);
2825
Assert.Same(host.
Container
, component2.Container);
2827
Assert.Same(component2, Assert.Single(host.
Container
.Components));
2834
host.
Container
.Remove(component2);
2839
Assert.Empty(host.
Container
.Components);
2860
host.
Container
.Add(component);
2861
host.
Container
.Remove(component);
2873
host.
Container
.Add(component);
2878
host.
Container
.Remove(component);
3092
Assert.Equal(typeof(IDesignerHost).GetMember(nameof(IDesignerHost.
Container
)), reflect.GetMember(nameof(IDesignerHost.
Container
), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public));
3125
Assert.Equal(typeof(IDesignerHost).GetProperty(nameof(IDesignerHost.
Container
)), reflect.GetProperty(nameof(IDesignerHost.
Container
), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public));
3126
Assert.Equal(typeof(IDesignerHost).GetProperty(nameof(IDesignerHost.
Container
)), reflect.GetProperty(nameof(IDesignerHost.
Container
), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public, null, typeof(IContainer), Array.Empty<Type>(), Array.Empty<ParameterModifier>()));
3142
Assert.Equal(surface.Host.
Container
, reflect.InvokeMember(nameof(IDesignerHost.
Container
), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public | BindingFlags.GetProperty, null, surface.Host, Array.Empty<object>(), Array.Empty<ParameterModifier>(), null, Array.Empty<string>()));
System\ComponentModel\Design\DesignSurfaceTests.cs (5)
21
Assert.Same(surface.Host, surface.Host.
Container
);
60
Assert.Same(surface.Host, surface.Host.
Container
);
82
Assert.Same(surface.Host, surface.Host.
Container
);
104
Assert.Same(surface.Host, surface.Host.
Container
);
151
Assert.Same(surface.Host, surface.Host.
Container
);
System\ComponentModel\Design\Serialization\DesignerSerializationManagerTests.cs (3)
44
.Setup(h => h.
Container
)
722
.Setup(h => h.
Container
)
810
.Setup(h => h.
Container
)
System\ComponentModel\Design\SiteNestedContainerTests.cs (4)
83
Assert.Empty(host.
Container
.Components);
90
Assert.Empty(host.
Container
.Components);
100
Assert.Empty(host.
Container
.Components);
971
Assert.Empty(host.
Container
.Components);
System\Windows\Forms\Design\FlowPanelDesignerTests.cs (1)
19
mockHost.Setup(host => host.
Container
).Returns(mockContainer.Object);
System.Windows.Forms.Tests (5)
System\Windows\Forms\PropertyGridTests.cs (5)
2717
.Setup(h => h.
Container
)
2817
.Setup(h => h.
Container
)
2841
.Setup(h => h.
Container
)
2937
.Setup(h => h.
Container
)
2971
.Setup(h => h.
Container
)