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
- AnyReturnReader.cs
- LocalValueEnumerator.cs
- DescendantQuery.cs
- MenuItemBindingCollection.cs
- ISAPIApplicationHost.cs
- DataGridTextBoxColumn.cs
- RemoteHelper.cs
- IListConverters.cs
- Literal.cs
- ServiceDesigner.cs
- ToolStripLocationCancelEventArgs.cs
- Util.cs
- GroupDescription.cs
- StatusBarPanel.cs
- ColorEditor.cs
- IndicShape.cs
- DivideByZeroException.cs
- NetStream.cs
- EpmSourceTree.cs
- SqlProfileProvider.cs
- DataTrigger.cs
- TextHidden.cs
- PermissionSetEnumerator.cs
- TransactionBridge.cs
- Metafile.cs
- CopyNamespacesAction.cs
- SmtpTransport.cs
- DataServiceExpressionVisitor.cs
- SafeIUnknown.cs
- Helpers.cs
- LocalIdCollection.cs
- ObjectStateFormatter.cs
- RuntimeConfigLKG.cs
- Transform.cs
- ExtendedPropertyCollection.cs
- ApplicationCommands.cs
- DefaultPropertyAttribute.cs
- DataColumnMapping.cs
- TokenizerHelper.cs
- Point3DAnimationBase.cs
- ProfileModule.cs
- SwitchCase.cs
- TaskScheduler.cs
- XmlnsDictionary.cs
- EntityDataSourceChangedEventArgs.cs
- NamespaceTable.cs
- FrameworkElement.cs
- MethodExpression.cs
- GeneralTransformGroup.cs
- SizeLimitedCache.cs
- MD5CryptoServiceProvider.cs
- TextBoxLine.cs
- TriggerAction.cs
- CollectionType.cs
- DaylightTime.cs
- ValidatorCompatibilityHelper.cs
- GraphicsPath.cs
- OleDbReferenceCollection.cs
- WindowsGraphics2.cs
- TranslateTransform3D.cs
- KeyFrames.cs
- IntegrationExceptionEventArgs.cs
- PackWebRequest.cs
- ScriptResourceAttribute.cs
- DEREncoding.cs
- Color.cs
- SqlBuffer.cs
- TemplateAction.cs
- ScriptControlDescriptor.cs
- MaskInputRejectedEventArgs.cs
- ObjectDataSource.cs
- XmlSerializerVersionAttribute.cs
- PropertyContainer.cs
- VisualStateManager.cs
- ISSmlParser.cs
- ImageUrlEditor.cs
- ItemChangedEventArgs.cs
- ClientCredentialsElement.cs
- ResourceCategoryAttribute.cs
- RsaSecurityTokenAuthenticator.cs
- WorkflowRuntimeService.cs
- BatchStream.cs
- UrlMappingsModule.cs
- ErrorStyle.cs
- AdRotatorDesigner.cs
- ReferenceSchema.cs
- FamilyMap.cs
- ValueSerializerAttribute.cs
- MetadataArtifactLoaderCompositeResource.cs
- MarkupWriter.cs
- SqlDependency.cs
- PointLightBase.cs
- SettingsPropertyWrongTypeException.cs
- ListViewSelectEventArgs.cs
- XmlAnyAttributeAttribute.cs
- RegionData.cs
- PerspectiveCamera.cs
- GridView.cs
- RegularExpressionValidator.cs
- HiddenField.cs