internal NonscalarTypeHeader(OutGridViewCommand parentCmd, PSObject input) : base(parentCmd) { // Prepare a table view. TableView tableView = new TableView(); tableView.Initialize(parentCmd._expressionFactory, parentCmd._typeInfoDataBase); // Request a view definition from the type database. ViewDefinition viewDefinition = DisplayDataQuery.GetViewByShapeAndType(parentCmd._expressionFactory, parentCmd._typeInfoDataBase, FormatShape.Table, input.TypeNames, null); if (viewDefinition != null) { // Create a header using a view definition provided by the types database. parentCmd._windowProxy.AddColumnsAndItem(input, tableView, (TableControlBody)viewDefinition.mainControl); // Remember all type names and type groups the current view applies to. _appliesTo = viewDefinition.appliesTo; } else { // Create a header using only the input object's properties. parentCmd._windowProxy.AddColumnsAndItem(input, tableView); _appliesTo = new AppliesTo(); // Add all type names except for Object and MarshalByRefObject types because they are too generic. // Leave the Object type name if it is the only type name. int index = 0; foreach (string typeName in input.TypeNames) { if (index > 0 && (typeName.Equals(typeof(Object).FullName, StringComparison.OrdinalIgnoreCase) || typeName.Equals(typeof(MarshalByRefObject).FullName, StringComparison.OrdinalIgnoreCase))) { break; } _appliesTo.AddAppliesToType(typeName); index++; } } }