Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / WebParts / CatalogZoneAutoFormat.cs / 1 / CatalogZoneAutoFormat.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design.WebControls.WebParts { using System.Data; using System.Design; using System.Globalization; using System.Web.UI.WebControls.WebParts; internal sealed class CatalogZoneAutoFormat : BaseAutoFormat { internal const string PreviewControlID = "AutoFormatPreviewControl"; public CatalogZoneAutoFormat(DataRow schemeData) : base(schemeData) { // Use default Height Style.Width = 300; } public override Control GetPreviewControl(Control runtimeControl) { CatalogZone previewZone = (CatalogZone)base.GetPreviewControl(runtimeControl); // If the zone contains no CatalogParts, set the ZoneTemplate to a dummy Template, so // that there is at least one CatalogPart in the AutoFormat preview if (previewZone != null && previewZone.CatalogParts.Count == 0) { previewZone.ZoneTemplate = new AutoFormatTemplate(); } // Set the ID of the zone to the special PreviewControlID, so the CatalogZoneDesigner // doesn't render the placeholder for this control in the AutoFormat dialog, regardless // of whether ViewInEditMode is true. previewZone.ID = PreviewControlID; return previewZone; } private sealed class AutoFormatTemplate : ITemplate { public void InstantiateIn(Control container) { DeclarativeCatalogPart sampleCatalogPart = new DeclarativeCatalogPart(); sampleCatalogPart.WebPartsTemplate = new SampleCatalogPartTemplate(); sampleCatalogPart.ID = "SampleCatalogPart"; container.Controls.Add(sampleCatalogPart); } private sealed class SampleCatalogPartTemplate : ITemplate { public void InstantiateIn(Control container) { SampleWebPart sampleWebPart = new SampleWebPart(); sampleWebPart.ID = "SampleWebPart1"; sampleWebPart.Title = String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.CatalogZone_SampleWebPartTitle), "1"); container.Controls.Add(sampleWebPart); sampleWebPart = new SampleWebPart(); sampleWebPart.ID = "SampleWebPart2"; sampleWebPart.Title = String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.CatalogZone_SampleWebPartTitle), "2"); container.Controls.Add(sampleWebPart); sampleWebPart = new SampleWebPart(); sampleWebPart.ID = "SampleWebPart3"; sampleWebPart.Title = String.Format(CultureInfo.CurrentCulture, SR.GetString(SR.CatalogZone_SampleWebPartTitle), "3"); container.Controls.Add(sampleWebPart); } private sealed class SampleWebPart : WebPart { } } } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. // Copyright (c) Microsoft Corporation. All rights reserved.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- ResourceType.cs
- PointKeyFrameCollection.cs
- ComponentCollection.cs
- PathSegment.cs
- CorrelationExtension.cs
- JournalEntryStack.cs
- UnauthorizedWebPart.cs
- SecurityRequiresReviewAttribute.cs
- SrgsItemList.cs
- DataGridTextColumn.cs
- SafeNativeMemoryHandle.cs
- ObjectKeyFrameCollection.cs
- SelectedGridItemChangedEvent.cs
- DataGridLinkButton.cs
- Wow64ConfigurationLoader.cs
- RequestDescription.cs
- XmlSchema.cs
- SqlConnectionHelper.cs
- DataGridViewRowContextMenuStripNeededEventArgs.cs
- MouseGesture.cs
- CellIdBoolean.cs
- keycontainerpermission.cs
- FirstMatchCodeGroup.cs
- TemplateControlCodeDomTreeGenerator.cs
- ListViewItemEventArgs.cs
- ProcessHostServerConfig.cs
- AuthorizationSection.cs
- ServiceProviders.cs
- SortableBindingList.cs
- TreeNodeBindingDepthConverter.cs
- GeometryCombineModeValidation.cs
- XsltInput.cs
- UnsafeNativeMethods.cs
- TableCellCollection.cs
- log.cs
- BinaryMessageEncodingBindingElement.cs
- TrustExchangeException.cs
- OleDbEnumerator.cs
- TreeView.cs
- PrintingPermission.cs
- AggregationMinMaxHelpers.cs
- ActivityStateQuery.cs
- BindMarkupExtensionSerializer.cs
- StringDictionary.cs
- DBAsyncResult.cs
- Transform3D.cs
- ConnectionStringsExpressionEditor.cs
- SamlDelegatingWriter.cs
- HtmlTableRowCollection.cs
- CallbackTimeoutsBehavior.cs
- PatternMatcher.cs
- TextDecorationUnitValidation.cs
- BooleanFunctions.cs
- ToolbarAUtomationPeer.cs
- SoapInteropTypes.cs
- WindowsSecurityTokenAuthenticator.cs
- PreviewControlDesigner.cs
- Compiler.cs
- ColorTransformHelper.cs
- Int16AnimationUsingKeyFrames.cs
- Wizard.cs
- OrderedDictionaryStateHelper.cs
- QueryContext.cs
- OleStrCAMarshaler.cs
- IMembershipProvider.cs
- PresentationTraceSources.cs
- KernelTypeValidation.cs
- XmlNodeChangedEventArgs.cs
- XmlNamespaceManager.cs
- ClientCredentials.cs
- BoolExpression.cs
- RestClientProxyHandler.cs
- AssemblyBuilder.cs
- ContextStaticAttribute.cs
- SessionStateUtil.cs
- HttpListenerRequest.cs
- ChannelBase.cs
- Bidi.cs
- ItemsControl.cs
- XsltContext.cs
- OleDbWrapper.cs
- WeakHashtable.cs
- PeerOutputChannel.cs
- Pair.cs
- RtfFormatStack.cs
- ControlParameter.cs
- SmtpLoginAuthenticationModule.cs
- XPathEmptyIterator.cs
- SchemaCollectionPreprocessor.cs
- FullTextBreakpoint.cs
- SvcFileManager.cs
- Panel.cs
- SettingsPropertyCollection.cs
- BinaryMessageEncodingElement.cs
- Rotation3D.cs
- TdsParserStaticMethods.cs
- ChunkedMemoryStream.cs
- Exceptions.cs
- MetafileEditor.cs
- HtmlInputCheckBox.cs