Code:
/ 4.0 / 4.0 / DEVDIV_TFS / Dev10 / Releases / RTMRel / ndp / cdf / src / NetFx40 / Tools / System.Activities.Presentation / System / Activities / Presentation / Converters / ModelToObjectValueConverter.cs / 1305376 / ModelToObjectValueConverter.cs
//---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.Converters { using System.Windows.Data; using System.Globalization; using System.Activities.Presentation.Model; // This class is used to convert a ModelItem to the innerobject, when binding to whole objectin xaml. // reverse conversion is not required beacuse ModelProperty.SetValue accepts object as is. public class ModelToObjectValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { object convertedValue = null; if (value != null) { if (value is ModelItem) { convertedValue = ((ModelItem)value).GetCurrentValue(); } else { convertedValue = value; } } return convertedValue; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return value; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007. //---------------------------------------------------------------- // Copyright (c) Microsoft Corporation. All rights reserved. //--------------------------------------------------------------- namespace System.Activities.Presentation.Converters { using System.Windows.Data; using System.Globalization; using System.Activities.Presentation.Model; // This class is used to convert a ModelItem to the innerobject, when binding to whole objectin xaml. // reverse conversion is not required beacuse ModelProperty.SetValue accepts object as is. public class ModelToObjectValueConverter : IValueConverter { public object Convert(object value, Type targetType, object parameter, CultureInfo culture) { object convertedValue = null; if (value != null) { if (value is ModelItem) { convertedValue = ((ModelItem)value).GetCurrentValue(); } else { convertedValue = value; } } return convertedValue; } public object ConvertBack(object value, Type targetType, object parameter, CultureInfo culture) { return value; } } } // File provided for Reference Use Only by Microsoft Corporation (c) 2007.
Link Menu
This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- DisposableCollectionWrapper.cs
- ResourcePool.cs
- FillRuleValidation.cs
- EntityDescriptor.cs
- PenContexts.cs
- ResourcesBuildProvider.cs
- MessageRpc.cs
- DbModificationClause.cs
- CaseKeyBox.xaml.cs
- EndpointAddressElementBase.cs
- RenderDataDrawingContext.cs
- SqlCacheDependencyDatabaseCollection.cs
- StretchValidation.cs
- HttpRequestContext.cs
- EventDescriptor.cs
- NetMsmqBinding.cs
- StackBuilderSink.cs
- PersonalizationStateQuery.cs
- TextContainerHelper.cs
- EncryptedData.cs
- PointUtil.cs
- MarkupCompilePass2.cs
- ImageBrush.cs
- NativeMethods.cs
- XamlNamespaceHelper.cs
- ToolStripComboBox.cs
- ProcessInfo.cs
- CallbackHandler.cs
- SqlNodeTypeOperators.cs
- OracleBinary.cs
- PrePostDescendentsWalker.cs
- EdmRelationshipNavigationPropertyAttribute.cs
- RegexCharClass.cs
- EdmSchemaError.cs
- XmlObjectSerializerReadContextComplexJson.cs
- Path.cs
- HtmlTernaryTree.cs
- XPathConvert.cs
- ExpressionList.cs
- TemplateComponentConnector.cs
- WorkflowServiceHostFactory.cs
- ProxyAttribute.cs
- ToolStripManager.cs
- NameValuePair.cs
- Setter.cs
- CodeCommentStatement.cs
- DynamicMethod.cs
- DockEditor.cs
- RefExpr.cs
- x509store.cs
- TableRow.cs
- ImageAutomationPeer.cs
- OleDbReferenceCollection.cs
- CheckBoxRenderer.cs
- COMException.cs
- EmptyQuery.cs
- FormClosedEvent.cs
- GenericIdentity.cs
- ToolStripOverflowButton.cs
- UIInitializationException.cs
- ObjectDataSourceSelectingEventArgs.cs
- MetaTableHelper.cs
- Attributes.cs
- StatusInfoItem.cs
- GeometryConverter.cs
- DigitShape.cs
- InkCanvasFeedbackAdorner.cs
- Rule.cs
- FormatStringEditor.cs
- RoleService.cs
- MatrixIndependentAnimationStorage.cs
- EntityViewContainer.cs
- StylusEventArgs.cs
- AutomationElement.cs
- TextServicesContext.cs
- BCLDebug.cs
- TransactionScope.cs
- TreeNodeCollection.cs
- UnmanagedMemoryStreamWrapper.cs
- SqlConnectionString.cs
- EditingCommands.cs
- ContentAlignmentEditor.cs
- MulticastDelegate.cs
- _RegBlobWebProxyDataBuilder.cs
- NetworkStream.cs
- BinaryCommonClasses.cs
- TTSEvent.cs
- PermissionToken.cs
- SqlUdtInfo.cs
- AllMembershipCondition.cs
- Trace.cs
- WebPartConnection.cs
- VerifyHashRequest.cs
- ZipFileInfo.cs
- Condition.cs
- DrawingVisualDrawingContext.cs
- MaskedTextProvider.cs
- EntityModelSchemaGenerator.cs
- LayoutEditorPart.cs
- ServiceModelSecurityTokenTypes.cs