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
- Action.cs
- MetafileHeaderWmf.cs
- PaintEvent.cs
- ArithmeticException.cs
- SecureUICommand.cs
- SimplePropertyEntry.cs
- Int64Converter.cs
- PopupRoot.cs
- StringFormat.cs
- GroupItem.cs
- EventTrigger.cs
- ConfigurationException.cs
- ColorContextHelper.cs
- UrlPropertyAttribute.cs
- NGCSerializationManager.cs
- AssociationType.cs
- ReferencedCollectionType.cs
- ToolboxItemFilterAttribute.cs
- BinaryObjectInfo.cs
- DataGridViewCellStyleEditor.cs
- TaskbarItemInfo.cs
- DataServiceClientException.cs
- PropertyDescriptorCollection.cs
- XamlTreeBuilder.cs
- NullExtension.cs
- DataServiceExpressionVisitor.cs
- Thickness.cs
- BeginStoryboard.cs
- MouseButtonEventArgs.cs
- Utils.cs
- ConfigXmlReader.cs
- ConfigurationManagerHelperFactory.cs
- XmlSchemaParticle.cs
- ReturnEventArgs.cs
- Compensate.cs
- TemplateEditingVerb.cs
- SimpleType.cs
- BmpBitmapDecoder.cs
- DbgCompiler.cs
- ManipulationStartedEventArgs.cs
- LabelDesigner.cs
- NullableBoolConverter.cs
- ImageListUtils.cs
- Location.cs
- SystemIPv4InterfaceProperties.cs
- securitycriticaldataClass.cs
- SymbolType.cs
- InvalidFilterCriteriaException.cs
- DataGridViewComboBoxCell.cs
- StringConcat.cs
- CapabilitiesSection.cs
- DependencyProperty.cs
- CrossSiteScriptingValidation.cs
- TreePrinter.cs
- CodeAttributeArgument.cs
- FolderBrowserDialog.cs
- HttpGetServerProtocol.cs
- ObjectManager.cs
- MetadataArtifactLoaderCompositeResource.cs
- SystemFonts.cs
- PropertyGridDesigner.cs
- SiteMapSection.cs
- PrivateUnsafeNativeCompoundFileMethods.cs
- InfoCardSymmetricCrypto.cs
- PrefixQName.cs
- MergePropertyDescriptor.cs
- SqlTriggerContext.cs
- ElementMarkupObject.cs
- XmlDocumentViewSchema.cs
- SmtpSpecifiedPickupDirectoryElement.cs
- HwndMouseInputProvider.cs
- SizeKeyFrameCollection.cs
- DataRelationCollection.cs
- ReachSerializer.cs
- ManagementDateTime.cs
- HttpStreamMessage.cs
- UIElementPropertyUndoUnit.cs
- ControlAdapter.cs
- MatrixKeyFrameCollection.cs
- FrameSecurityDescriptor.cs
- FormatConvertedBitmap.cs
- XmlSchemaAnnotation.cs
- RequestResizeEvent.cs
- HierarchicalDataBoundControl.cs
- ObjectStateEntryOriginalDbUpdatableDataRecord.cs
- AsyncStreamReader.cs
- CqlBlock.cs
- CommonXSendMessage.cs
- MetadataItem_Static.cs
- CallSiteBinder.cs
- StrokeCollectionDefaultValueFactory.cs
- KeyboardDevice.cs
- FontDialog.cs
- SystemException.cs
- SelectionItemPattern.cs
- CoreSwitches.cs
- FlowDocumentScrollViewerAutomationPeer.cs
- OdbcConnectionString.cs
- HtmlElementEventArgs.cs
- DriveInfo.cs