Code:
/ FX-1434 / FX-1434 / 1.0 / untmp / whidbey / REDBITS / ndp / fx / src / Designer / WebForms / System / Web / UI / Design / TemplateDefinition.cs / 1 / TemplateDefinition.cs
//------------------------------------------------------------------------------ //// Copyright (c) Microsoft Corporation. All rights reserved. // //----------------------------------------------------------------------------- namespace System.Web.UI.Design { using System; using System.ComponentModel; using System.ComponentModel.Design; using System.Design; using System.Diagnostics; using System.Web.UI.WebControls; ///public class TemplateDefinition : DesignerObject { private Style _style; private string _templatePropertyName; private object _templatedObject; private PropertyDescriptor _templateProperty; private bool _serverControlsOnly; private bool _supportsDataBinding; /// public TemplateDefinition(ControlDesigner designer, string name, object templatedObject, string templatePropertyName) : this(designer, name, templatedObject, templatePropertyName, false) { } /// public TemplateDefinition(ControlDesigner designer, string name, object templatedObject, string templatePropertyName, Style style) : this(designer, name, templatedObject, templatePropertyName, style, false) { } /// public TemplateDefinition(ControlDesigner designer, string name, object templatedObject, string templatePropertyName, bool serverControlsOnly) : this(designer, name, templatedObject, templatePropertyName, null, serverControlsOnly) { } /// public TemplateDefinition(ControlDesigner designer, string name, object templatedObject, string templatePropertyName, Style style, bool serverControlsOnly) : base(designer, name) { if ((templatePropertyName == null) || (templatePropertyName.Length == 0)) { throw new ArgumentNullException("templatePropertyName"); } if (templatedObject == null) { throw new ArgumentNullException("templatedObject"); } _serverControlsOnly = serverControlsOnly; _style = style; _templatedObject = templatedObject; _templatePropertyName = templatePropertyName; } public virtual bool AllowEditing { get { return true; } } /// public virtual string Content { get { ITemplate template = (ITemplate)TemplateProperty.GetValue(TemplatedObject); IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); return ControlPersister.PersistTemplate(template, host); } set { IDesignerHost host = (IDesignerHost)GetService(typeof(IDesignerHost)); ITemplate template = ControlParser.ParseTemplate(host, value); TemplateProperty.SetValue(TemplatedObject, template); } } /// /// public bool ServerControlsOnly { get { return _serverControlsOnly; } } ////// public bool SupportsDataBinding { get { return _supportsDataBinding; } set { _supportsDataBinding = value; } } ////// /// public Style Style { get { return _style; } } ///public object TemplatedObject { get { return _templatedObject; } } private PropertyDescriptor TemplateProperty { get { if (_templateProperty == null) { _templateProperty = TypeDescriptor.GetProperties(TemplatedObject)[TemplatePropertyName]; if ((_templateProperty == null) || !typeof(ITemplate).IsAssignableFrom(_templateProperty.PropertyType)) { throw new InvalidOperationException(SR.GetString(SR.TemplateDefinition_InvalidTemplateProperty, TemplatePropertyName)); } } return _templateProperty; } } /// public string TemplatePropertyName { get { return _templatePropertyName; } } } } // 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
- DataGridAutoGeneratingColumnEventArgs.cs
- TextChange.cs
- EventMappingSettings.cs
- SyntaxCheck.cs
- Point3DCollection.cs
- MouseBinding.cs
- SqlConnection.cs
- SmtpFailedRecipientsException.cs
- Int64Animation.cs
- PagerSettings.cs
- ProjectedSlot.cs
- ConfigPathUtility.cs
- CodeTypeDeclarationCollection.cs
- MediaPlayerState.cs
- XmlSchemaCollection.cs
- EndPoint.cs
- DataGridViewCellCollection.cs
- NotifyIcon.cs
- VarRemapper.cs
- QueryTaskGroupState.cs
- ParameterExpression.cs
- TargetControlTypeCache.cs
- ButtonRenderer.cs
- AsyncParams.cs
- ArrayExtension.cs
- InvokePattern.cs
- ComIntegrationManifestGenerator.cs
- PropertyTab.cs
- ColumnWidthChangedEvent.cs
- LayoutInformation.cs
- PhoneCall.cs
- EntityDesignerUtils.cs
- XmlSchemaGroupRef.cs
- RectAnimation.cs
- MultiPropertyDescriptorGridEntry.cs
- Thickness.cs
- ProjectionCamera.cs
- TextProperties.cs
- ToolStripSplitButton.cs
- Message.cs
- FlowDocumentScrollViewer.cs
- AdRotator.cs
- UInt32.cs
- DataList.cs
- TextTreeTextNode.cs
- PriorityChain.cs
- EntityDataSourceViewSchema.cs
- TextServicesDisplayAttribute.cs
- Rotation3DAnimationUsingKeyFrames.cs
- BuildManager.cs
- InkPresenter.cs
- EmbeddedMailObjectsCollection.cs
- AssemblyAttributes.cs
- FlowLayout.cs
- ContentValidator.cs
- BaseProcessProtocolHandler.cs
- StrongName.cs
- XmlSchemaObject.cs
- IOThreadScheduler.cs
- DecimalAnimationUsingKeyFrames.cs
- BaseAsyncResult.cs
- FixedTextContainer.cs
- CodeNamespace.cs
- AdRotatorDesigner.cs
- XPathNodePointer.cs
- SQLConvert.cs
- MobileControlsSectionHandler.cs
- IntellisenseTextBox.cs
- Block.cs
- ReadOnlyNameValueCollection.cs
- CapabilitiesPattern.cs
- ConstraintEnumerator.cs
- Condition.cs
- GenericWebPart.cs
- BitmapEncoder.cs
- AudioLevelUpdatedEventArgs.cs
- Blend.cs
- TableLayoutRowStyleCollection.cs
- login.cs
- BitmapEffectDrawingContextState.cs
- BevelBitmapEffect.cs
- ElementUtil.cs
- DockingAttribute.cs
- TextAction.cs
- ProcessModelInfo.cs
- ExternalException.cs
- RepeaterItemCollection.cs
- DataReceivedEventArgs.cs
- FrameworkReadOnlyPropertyMetadata.cs
- BitVector32.cs
- ToolStripSeparator.cs
- XmlAttributeHolder.cs
- ToolStripContentPanel.cs
- PropertyItem.cs
- EntityContainerRelationshipSet.cs
- TaiwanCalendar.cs
- BitStream.cs
- HyperLinkColumn.cs
- DataServiceEntityAttribute.cs
- DataGridViewCellStyle.cs