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)
38
Assert.Same(host, host.
Container
);
281
host.
Container
.Add(component1);
282
Assert.Same(component1, Assert.Single(host.
Container
.Components));
292
host.
Container
.Add(component2);
293
Assert.Equal(new IComponent[] { component1, component2 }, host.
Container
.Components.Cast<IComponent>());
303
host.
Container
.Add(component3);
304
Assert.Equal(new IComponent[] { component1, component2, component3 }, host.
Container
.Components.Cast<IComponent>());
314
host.
Container
.Add(component4);
315
Assert.Equal(new IComponent[] { component1, component2, component3, component4 }, host.
Container
.Components.Cast<IComponent>());
336
host.
Container
.Add(component1, "name1");
337
Assert.Same(component1, Assert.Single(host.
Container
.Components));
347
host.
Container
.Add(component2, "name2");
348
Assert.Equal(new IComponent[] { component1, component2 }, host.
Container
.Components.Cast<IComponent>());
358
host.
Container
.Add(component3, string.Empty);
359
Assert.Equal(new IComponent[] { component1, component2, component3 }, host.
Container
.Components.Cast<IComponent>());
369
host.
Container
.Add(component4, null);
370
Assert.Equal(new IComponent[] { component1, component2, component3, component4 }, host.
Container
.Components.Cast<IComponent>());
430
host.
Container
.Add(component);
431
Assert.Same(component, Assert.Single(host.
Container
.Components));
437
host.
Container
.Add(component);
438
Assert.Same(component, Assert.Single(host.
Container
.Components));
444
host.
Container
.Add(component, "name");
445
Assert.Same(component, Assert.Single(host.
Container
.Components));
500
host.
Container
.Add(component);
501
Assert.Same(component, Assert.Single(host.
Container
.Components));
507
host.
Container
.Add(component);
508
Assert.Same(component, Assert.Single(host.
Container
.Components));
514
host.
Container
.Add(component, "name");
515
Assert.Same(component, Assert.Single(host.
Container
.Components));
573
host.
Container
.Add(component);
574
Assert.Same(component, Assert.Single(host.
Container
.Components));
586
host.
Container
.Add(component);
587
Assert.Same(component, Assert.Single(host.
Container
.Components));
598
host.
Container
.Add(component);
599
Assert.Same(component, Assert.Single(host.
Container
.Components));
603
host.
Container
.Add(component);
604
Assert.Same(component, Assert.Single(host.
Container
.Components));
608
host.
Container
.Add(component, "name");
609
Assert.Same(component, Assert.Single(host.
Container
.Components));
639
host.
Container
.Add(component);
641
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
643
host.
Container
.Add(component, null);
645
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
694
host.
Container
.Add(component);
696
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
698
host.
Container
.Add(component, null);
700
mockNameCreationService.Verify(s => s.CreateName(host.
Container
, typeof(RootDesignerComponent)), Times.Once());
729
host.
Container
.Add(component1, name);
736
host.
Container
.Add(component2, "name2");
789
host.
Container
.Add(component1, "name1");
800
host.
Container
.Add(component2, "name2");
836
host.
Container
.Add(component, "name1");
880
host.
Container
.Add(component, "name1");
894
host.
Container
.Add(component);
899
Assert.Throws<Exception>(() => host.
Container
.Add(newComponent));
915
host.
Container
.Add(component);
928
host.
Container
.Add(component);
947
host.
Container
.Add(component);
959
host.
Container
.Add(component);
977
host.
Container
.Add(component);
989
host.
Container
.Add(component);
1007
host.
Container
.Add(component);
1043
host.
Container
.Add(component);
1070
host.
Container
.Add(component);
1103
host.
Container
.Add(component);
1133
host.
Container
.Add(component);
1167
host.
Container
.Add(component);
1205
host.
Container
.Add(component);
1240
host.
Container
.Add(component);
1269
host.
Container
.Add(component, oldName);
1286
host.
Container
.Add(component, "name");
1304
host.
Container
.Add(component1);
1305
host.
Container
.Add(component2, null);
1306
host.
Container
.Add(component3, "name3");
1357
host.
Container
.Add(component, oldName);
1387
host.
Container
.Add(component, "oldName");
1436
host.
Container
.Add(component, "oldName");
1452
host.
Container
.Add(component1, "name1");
1453
host.
Container
.Add(component2, "name2");
1479
host.
Container
.Add(component);
1504
host.
Container
.Add(component);
1517
host.
Container
.Add(component);
1551
host.
Container
.Add(component);
1564
host.
Container
.Add(component);
1574
host.
Container
.Add(component);
1584
host.
Container
.Add(component);
1594
host.
Container
.Add(component);
1625
host.
Container
.Add(component);
1626
Assert.Same(host.
Container
, component.Container);
1631
host.
Container
.Add(component);
1632
Assert.Same(host.
Container
, component.Container);
1639
host.
Container
.Add(component);
1640
Assert.Same(host.
Container
, component.Container);
1657
Assert.Throws<NotImplementedException>(() => host.
Container
.Add(component));
1658
Assert.Throws<NotImplementedException>(() => host.
Container
.Add(component, "name"));
1659
Assert.Empty(host.
Container
.Components);
1668
host.
Container
.Add(component, component.GetType().FullName);
1670
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(component));
1671
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(new RootDesignerComponent(), host.RootComponentClassName));
1680
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(component));
1681
Assert.Throws<InvalidOperationException>(() => host.
Container
.Add(component, "name"));
1690
Assert.Throws<DivideByZeroException>(() => host.
Container
.Add(component));
1694
Assert.Throws<DivideByZeroException>(() => host.
Container
.Add(component, "name"));
1709
host.
Container
.Add(component);
1717
Assert.Same(host.
Container
, component.Container);
1720
host.
Container
.Add(component, "name");
1721
Assert.Same(host.
Container
, component.Container);
1813
host.
Container
.Add(component);
1828
host.
Container
.Add(component);
2255
host.
Container
.Add(component);
2533
host.
Container
.Add(rootComponent);
2534
host.
Container
.Add(component);
2535
host.
Container
.Remove(rootComponent);
2536
Assert.Same(component, Assert.Single(host.
Container
.Components));
2543
Assert.Same(host.
Container
, component.Container);
2547
host.
Container
.Remove(rootComponent);
2548
Assert.Same(component, Assert.Single(host.
Container
.Components));
2555
Assert.Same(host.
Container
, component.Container);
2559
host.
Container
.Remove(component);
2560
Assert.Empty(host.
Container
.Components);
2621
host.
Container
.Add(component);
2622
Assert.Same(component, Assert.Single(host.
Container
.Components));
2627
host.
Container
.Remove(component);
2628
Assert.Empty(host.
Container
.Components);
2634
host.
Container
.Remove(component);
2635
Assert.Empty(host.
Container
.Components);
2690
host.
Container
.Add(component);
2691
Assert.Same(component, Assert.Single(host.
Container
.Components));
2697
host.
Container
.Remove(component);
2698
Assert.Empty(host.
Container
.Components);
2704
host.
Container
.Remove(component);
2705
Assert.Empty(host.
Container
.Components);
2720
host.
Container
.Add(component);
2721
Assert.Same(component, Assert.Single(host.
Container
.Components));
2724
host.
Container
.Remove(component);
2725
Assert.Empty(host.
Container
.Components);
2737
host.
Container
.Add(component);
2738
Assert.Same(component, Assert.Single(host.
Container
.Components));
2741
host.
Container
.Remove(component);
2742
Assert.Empty(host.
Container
.Components);
2756
host1.
Container
.Add(otherComponent);
2757
host2.
Container
.Add(component);
2758
host2.
Container
.Remove(otherComponent);
2759
host2.
Container
.Remove(new Component());
2760
Assert.Same(otherComponent, Assert.Single(host1.
Container
.Components));
2761
Assert.Same(component, Assert.Single(host2.
Container
.Components));
2773
host1.
Container
.Add(otherComponent);
2774
host2.
Container
.Remove(otherComponent);
2775
host2.
Container
.Remove(new Component());
2776
Assert.Same(otherComponent, Assert.Single(host1.
Container
.Components));
2777
Assert.Empty(host2.
Container
.Components);
2810
host.
Container
.Add(component1);
2811
host.
Container
.Add(component2);
2814
host.
Container
.Remove(component1);
2817
Assert.Same(host.
Container
, component2.Container);
2819
Assert.Same(component2, Assert.Single(host.
Container
.Components));
2824
host.
Container
.Remove(component1);
2827
Assert.Same(host.
Container
, component2.Container);
2829
Assert.Same(component2, Assert.Single(host.
Container
.Components));
2836
host.
Container
.Remove(component2);
2841
Assert.Empty(host.
Container
.Components);
2862
host.
Container
.Add(component);
2863
host.
Container
.Remove(component);
2875
host.
Container
.Add(component);
2880
host.
Container
.Remove(component);
3094
Assert.Equal(typeof(IDesignerHost).GetMember(nameof(IDesignerHost.
Container
)), reflect.GetMember(nameof(IDesignerHost.
Container
), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public));
3127
Assert.Equal(typeof(IDesignerHost).GetProperty(nameof(IDesignerHost.
Container
)), reflect.GetProperty(nameof(IDesignerHost.
Container
), BindingFlags.Instance | BindingFlags.Static | BindingFlags.Public));
3128
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>()));
3144
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)
23
Assert.Same(surface.Host, surface.Host.
Container
);
62
Assert.Same(surface.Host, surface.Host.
Container
);
84
Assert.Same(surface.Host, surface.Host.
Container
);
106
Assert.Same(surface.Host, surface.Host.
Container
);
153
Assert.Same(surface.Host, surface.Host.
Container
);
System\ComponentModel\Design\Serialization\DesignerSerializationManagerTests.cs (3)
46
.Setup(h => h.
Container
)
724
.Setup(h => h.
Container
)
812
.Setup(h => h.
Container
)
System\ComponentModel\Design\SiteNestedContainerTests.cs (4)
85
Assert.Empty(host.
Container
.Components);
92
Assert.Empty(host.
Container
.Components);
102
Assert.Empty(host.
Container
.Components);
973
Assert.Empty(host.
Container
.Components);
System\Windows\Forms\Design\FlowPanelDesignerTests.cs (1)
17
mockHost.Setup(host => host.
Container
).Returns(mockContainer.Object);
System.Windows.Forms.Tests (5)
System\Windows\Forms\PropertyGridTests.cs (5)
2719
.Setup(h => h.
Container
)
2819
.Setup(h => h.
Container
)
2843
.Setup(h => h.
Container
)
2939
.Setup(h => h.
Container
)
2973
.Setup(h => h.
Container
)