Code:
/ DotNET / DotNET / 8.0 / untmp / WIN_WINDOWS / lh_tools_devdiv_wpf / Windows / wcp / Framework / System / Windows / TemplateBindingExtensionConverter.cs / 1 / TemplateBindingExtensionConverter.cs
//------------------------------------------------------------------------ // // Microsoft Windows Client Platform // Copyright (C) Microsoft Corporation, 2005 // // File: ElementItem.cs // // Contents: Implements a converter to an instance descriptor for // TemplateBindingExtension // // Created: 04/28/2005 chuckj // //----------------------------------------------------------------------- using System; using System.ComponentModel; using System.ComponentModel.Design.Serialization; using System.Globalization; using System.Windows; using System.Security; namespace System.Windows { ////// Type converter to inform the serialization system how to construct a TemplateBindingExtension from /// an instance. It reports that Property should be used as the first parameter to the constructor. /// public class TemplateBindingExtensionConverter : TypeConverter { ////// Returns true if converting to an InstanceDescriptor /// /// /// ///public override bool CanConvertTo(ITypeDescriptorContext context, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { return true; } return base.CanConvertTo(context, destinationType); } /// /// Converts to an InstanceDescriptor /// ////// Critical: calls InstanceDescriptor ctor which LinkDemands /// PublicOK: can only make an InstanceDescriptor for TemplateBindingExtension, not an arbitrary class /// [SecurityCritical] public override object ConvertTo(ITypeDescriptorContext context, CultureInfo culture, object value, Type destinationType) { if (destinationType == typeof(InstanceDescriptor)) { if(value == null) throw new ArgumentNullException("value"); TemplateBindingExtension templateBinding = value as TemplateBindingExtension; if(templateBinding == null) throw new ArgumentException(SR.Get(SRID.MustBeOfType, "value", "TemplateBindingExtension"), "value"); return new InstanceDescriptor(typeof(TemplateBindingExtension).GetConstructor(new Type[] { typeof(DependencyProperty) }), new object[] { templateBinding.Property }); } return base.ConvertTo(context, culture, value, destinationType); } } } // 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
- CodePropertyReferenceExpression.cs
- StrokeNodeData.cs
- ELinqQueryState.cs
- FormViewModeEventArgs.cs
- Journal.cs
- ManagedFilter.cs
- VBCodeProvider.cs
- ModelItemImpl.cs
- NodeLabelEditEvent.cs
- DropSourceBehavior.cs
- CharUnicodeInfo.cs
- SubclassTypeValidator.cs
- _Connection.cs
- ApplyImportsAction.cs
- PeerTransportCredentialType.cs
- TcpPortSharing.cs
- safesecurityhelperavalon.cs
- BackoffTimeoutHelper.cs
- ObjectListComponentEditor.cs
- WebBaseEventKeyComparer.cs
- RawStylusInputReport.cs
- LeftCellWrapper.cs
- TabControlEvent.cs
- XsltArgumentList.cs
- PropertySegmentSerializer.cs
- TreeViewAutomationPeer.cs
- FontSource.cs
- AssemblyLoader.cs
- BrushValueSerializer.cs
- ImagingCache.cs
- FlowDocumentReader.cs
- PropertyChangedEventArgs.cs
- CodeDirectionExpression.cs
- WebPartMenu.cs
- ContractsBCL.cs
- DataKey.cs
- InheritanceAttribute.cs
- ControlBindingsCollection.cs
- SqlProviderServices.cs
- UpdateCompiler.cs
- LineGeometry.cs
- UrlPath.cs
- DataGridViewCheckBoxCell.cs
- FlowDocumentPageViewerAutomationPeer.cs
- SqlTrackingQuery.cs
- RuntimeHelpers.cs
- WorkflowEventArgs.cs
- TcpTransportSecurity.cs
- UnsafeNetInfoNativeMethods.cs
- CalendarDataBindingHandler.cs
- SqlRowUpdatedEvent.cs
- HostProtectionException.cs
- HTTPNotFoundHandler.cs
- DispatcherExceptionEventArgs.cs
- Suspend.cs
- _UriSyntax.cs
- TerminatorSinks.cs
- UserMapPath.cs
- ASCIIEncoding.cs
- CornerRadius.cs
- OlePropertyStructs.cs
- MouseGestureConverter.cs
- RelationalExpressions.cs
- ResolveNameEventArgs.cs
- DataControlFieldCell.cs
- XmlSchemaSubstitutionGroup.cs
- ColumnMap.cs
- OnOperation.cs
- PenThreadPool.cs
- RadioButton.cs
- WebContext.cs
- SchemaSetCompiler.cs
- FileUpload.cs
- brushes.cs
- CellParaClient.cs
- CqlIdentifiers.cs
- VideoDrawing.cs
- TypeExtensionSerializer.cs
- PenLineJoinValidation.cs
- ClientBuildManager.cs
- XmlCharType.cs
- FormViewInsertEventArgs.cs
- DiscoveryClientDocuments.cs
- _AutoWebProxyScriptEngine.cs
- _NestedMultipleAsyncResult.cs
- newinstructionaction.cs
- FilterException.cs
- PopupControlService.cs
- ToolStripCollectionEditor.cs
- XPathMultyIterator.cs
- DataDocumentXPathNavigator.cs
- SystemResourceKey.cs
- PeerNodeAddress.cs
- SoapFault.cs
- ImpersonateTokenRef.cs
- CornerRadius.cs
- CodeEntryPointMethod.cs
- CodeAccessSecurityEngine.cs
- MenuItem.cs
- BuildProviderCollection.cs