Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Base / Core / PropertyEditing / PropertyValueEditor.cs / 1305376 / PropertyValueEditor.cs
namespace System.Activities.Presentation.PropertyEditing {
using System;
using System.ComponentModel;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Activities.Presentation.Internal.Properties;
using System.Activities.Presentation;
using System.Runtime;
///
/// Container for any and all inline editor logic for properties. This class can hold
/// a single DataTemplates - one for Inline editor.
///
public class PropertyValueEditor {
private DataTemplate _inlineEditorTemplate;
///
/// Creates a PropertyValueEditor
///
public PropertyValueEditor() {
}
///
/// Creates a PropertyValueEditor
///
/// The DataTemplate that is used for an inline editor.
/// This DataTemplate has its DataContext set to a PropertyValue
public PropertyValueEditor(DataTemplate inlineEditorTemplate) {
_inlineEditorTemplate = inlineEditorTemplate;
}
///
/// Gets or sets the InlineEditorTemplate -- the DataTemplate that is used for an inline editor.
/// This DataTemplate has its DataContext set to a PropertyValue
///
[Fx.Tag.KnownXamlExternalAttribute]
public DataTemplate InlineEditorTemplate
{
get { return _inlineEditorTemplate; }
set { _inlineEditorTemplate = value; }
}
internal virtual DataTemplate GetPropertyValueEditor(PropertyContainerEditMode mode) {
return (mode == PropertyContainerEditMode.Inline) ? _inlineEditorTemplate : null;
}
///
/// Utility method that creates a new EditorAttribute for the specified
/// PropertyValueEditor
///
/// PropertyValueEditor instance for which to create
/// the new EditorAttribute
/// New EditorAttribute for the specified PropertyValueEditor
public static EditorAttribute CreateEditorAttribute(PropertyValueEditor editor) {
if (editor == null)
throw FxTrace.Exception.ArgumentNull("editor");
return CreateEditorAttribute(editor.GetType());
}
///
/// Utility method that creates a new EditorAttribute for the specified
/// PropertyValueEditor type
///
/// PropertyValueEditor type for which to create
/// the new EditorAttribute
/// New EditorAttribute for the specified PropertyValueEditor type
public static EditorAttribute CreateEditorAttribute(Type propertyValueEditorType) {
if (propertyValueEditorType == null)
throw FxTrace.Exception.ArgumentNull("propertyValueEditorType");
if (!typeof(PropertyValueEditor).IsAssignableFrom(propertyValueEditorType))
throw FxTrace.Exception.AsError(new ArgumentException(
string.Format(
CultureInfo.CurrentCulture,
Resources.Error_ArgIncorrectType,
"propertyValueEditorType",
typeof(PropertyValueEditor).Name)));
return new EditorAttribute(propertyValueEditorType, typeof(PropertyValueEditor));
}
}
}
// File provided for Reference Use Only by Microsoft Corporation (c) 2007.
// Copyright (c) Microsoft Corporation. All rights reserved.
namespace System.Activities.Presentation.PropertyEditing {
using System;
using System.ComponentModel;
using System.Globalization;
using System.Text;
using System.Windows;
using System.Activities.Presentation.Internal.Properties;
using System.Activities.Presentation;
using System.Runtime;
///
/// Container for any and all inline editor logic for properties. This class can hold
/// a single DataTemplates - one for Inline editor.
///
public class PropertyValueEditor {
private DataTemplate _inlineEditorTemplate;
///
/// Creates a PropertyValueEditor
///
public PropertyValueEditor() {
}
///
/// Creates a PropertyValueEditor
///
/// The DataTemplate that is used for an inline editor.
/// This DataTemplate has its DataContext set to a PropertyValue
public PropertyValueEditor(DataTemplate inlineEditorTemplate) {
_inlineEditorTemplate = inlineEditorTemplate;
}
///
/// Gets or sets the InlineEditorTemplate -- the DataTemplate that is used for an inline editor.
/// This DataTemplate has its DataContext set to a PropertyValue
///
[Fx.Tag.KnownXamlExternalAttribute]
public DataTemplate InlineEditorTemplate
{
get { return _inlineEditorTemplate; }
set { _inlineEditorTemplate = value; }
}
internal virtual DataTemplate GetPropertyValueEditor(PropertyContainerEditMode mode) {
return (mode == PropertyContainerEditMode.Inline) ? _inlineEditorTemplate : null;
}
///
/// Utility method that creates a new EditorAttribute for the specified
/// PropertyValueEditor
///
/// PropertyValueEditor instance for which to create
/// the new EditorAttribute
/// New EditorAttribute for the specified PropertyValueEditor
public static EditorAttribute CreateEditorAttribute(PropertyValueEditor editor) {
if (editor == null)
throw FxTrace.Exception.ArgumentNull("editor");
return CreateEditorAttribute(editor.GetType());
}
///
/// Utility method that creates a new EditorAttribute for the specified
/// PropertyValueEditor type
///
/// PropertyValueEditor type for which to create
/// the new EditorAttribute
/// New EditorAttribute for the specified PropertyValueEditor type
public static EditorAttribute CreateEditorAttribute(Type propertyValueEditorType) {
if (propertyValueEditorType == null)
throw FxTrace.Exception.ArgumentNull("propertyValueEditorType");
if (!typeof(PropertyValueEditor).IsAssignableFrom(propertyValueEditorType))
throw FxTrace.Exception.AsError(new ArgumentException(
string.Format(
CultureInfo.CurrentCulture,
Resources.Error_ArgIncorrectType,
"propertyValueEditorType",
typeof(PropertyValueEditor).Name)));
return new EditorAttribute(propertyValueEditorType, typeof(PropertyValueEditor));
}
}
}
// 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
- ScrollItemPattern.cs
- DesignerAdapterAttribute.cs
- TraceInternal.cs
- ResourceDescriptionAttribute.cs
- FontStyleConverter.cs
- HijriCalendar.cs
- GeometryCombineModeValidation.cs
- StorageEntityContainerMapping.cs
- XmlDocumentSerializer.cs
- DataGridViewTopRowAccessibleObject.cs
- DataExpression.cs
- ArithmeticLiteral.cs
- DeviceSpecificChoice.cs
- EditorZoneAutoFormat.cs
- HttpGetClientProtocol.cs
- AuthorizationContext.cs
- XmlLinkedNode.cs
- RegexFCD.cs
- PropertyDescriptor.cs
- PaginationProgressEventArgs.cs
- DefaultPropertyAttribute.cs
- TdsParameterSetter.cs
- _IPv6Address.cs
- PolicyUtility.cs
- TableCell.cs
- BitmapCodecInfoInternal.cs
- ConfigUtil.cs
- PageWrapper.cs
- NativeCppClassAttribute.cs
- ArraySegment.cs
- Thumb.cs
- ShaderEffect.cs
- NominalTypeEliminator.cs
- COM2DataTypeToManagedDataTypeConverter.cs
- WindowsAuthenticationModule.cs
- DataGridRelationshipRow.cs
- MessageDroppedTraceRecord.cs
- UriParserTemplates.cs
- UITypeEditors.cs
- WebAdminConfigurationHelper.cs
- FilteredDataSetHelper.cs
- TextBoxAutoCompleteSourceConverter.cs
- DataGridViewRowCancelEventArgs.cs
- MimeReturn.cs
- WebPartTransformer.cs
- NoClickablePointException.cs
- GroupPartitionExpr.cs
- RoleGroupCollection.cs
- TimeSpanConverter.cs
- OleDbInfoMessageEvent.cs
- TypedReference.cs
- XsdBuildProvider.cs
- MailFileEditor.cs
- ZipFileInfo.cs
- SessionSwitchEventArgs.cs
- ImageSource.cs
- MenuTracker.cs
- GPPOINTF.cs
- XPathConvert.cs
- BamlTreeNode.cs
- XPathBinder.cs
- ContainerSelectorGlyph.cs
- HTTP_SERVICE_CONFIG_URLACL_KEY.cs
- BaseCAMarshaler.cs
- Message.cs
- SrgsGrammar.cs
- PolyQuadraticBezierSegment.cs
- HttpConfigurationSystem.cs
- DataGridViewCellStyleConverter.cs
- Win32Exception.cs
- followingsibling.cs
- DataPagerFieldItem.cs
- HtmlTableCellCollection.cs
- DesignerActionUI.cs
- WebReferenceOptions.cs
- CrossContextChannel.cs
- WebResponse.cs
- Screen.cs
- ProgressChangedEventArgs.cs
- Odbc32.cs
- DbReferenceCollection.cs
- FileAuthorizationModule.cs
- AddInEnvironment.cs
- ScriptModule.cs
- LocationSectionRecord.cs
- NamedPipeHostedTransportConfiguration.cs
- TextEditor.cs
- HtmlTableCellCollection.cs
- WebRequestModulesSection.cs
- ColumnHeaderCollectionEditor.cs
- DataIdProcessor.cs
- TransformerTypeCollection.cs
- XmlComment.cs
- EntitySet.cs
- ScaleTransform.cs
- CngProperty.cs
- ObjectItemNoOpAssemblyLoader.cs
- StorageMappingItemLoader.cs
- QueryCacheKey.cs
- StringFormat.cs