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
- ConnectionPointGlyph.cs
- RadioButtonPopupAdapter.cs
- SizeAnimationBase.cs
- ProvideValueServiceProvider.cs
- AdapterSwitches.cs
- TextAdaptor.cs
- CopyAction.cs
- ComponentDispatcher.cs
- CustomLineCap.cs
- TreeView.cs
- FrameworkContextData.cs
- BinHexEncoder.cs
- InputScopeConverter.cs
- Condition.cs
- ArithmeticException.cs
- CommonProperties.cs
- DragDrop.cs
- ShaperBuffers.cs
- StretchValidation.cs
- CatalogPartChrome.cs
- XmlNamespaceDeclarationsAttribute.cs
- SoundPlayerAction.cs
- Int32CollectionConverter.cs
- CalloutQueueItem.cs
- ViewManager.cs
- Context.cs
- LoadItemsEventArgs.cs
- EdmPropertyAttribute.cs
- FlagsAttribute.cs
- Pair.cs
- CodeThrowExceptionStatement.cs
- SoapFault.cs
- ExpressionConverter.cs
- DocumentScope.cs
- FontStyle.cs
- localization.cs
- PropertyOverridesTypeEditor.cs
- ToolBarDesigner.cs
- VoiceChangeEventArgs.cs
- AdRotatorDesigner.cs
- RawContentTypeMapper.cs
- InstanceDataCollection.cs
- BindStream.cs
- System.Data.OracleClient_BID.cs
- dataprotectionpermission.cs
- EntityCodeGenerator.cs
- TextEditorTables.cs
- Vars.cs
- FullTextState.cs
- NameObjectCollectionBase.cs
- DbDeleteCommandTree.cs
- SortableBindingList.cs
- SuppressMessageAttribute.cs
- ColumnHeaderCollectionEditor.cs
- ArrayElementGridEntry.cs
- UrlAuthorizationModule.cs
- PriorityChain.cs
- Point.cs
- PassportAuthenticationModule.cs
- Expr.cs
- WindowsTreeView.cs
- clipboard.cs
- BitmapEffectDrawingContextWalker.cs
- Single.cs
- RoutedCommand.cs
- SizeValueSerializer.cs
- DocumentsTrace.cs
- UdpDuplexChannel.cs
- ObjectListField.cs
- AuthenticationSection.cs
- SingleSelectRootGridEntry.cs
- ResourcesChangeInfo.cs
- UTF7Encoding.cs
- BaseDataListDesigner.cs
- ScrollContentPresenter.cs
- Misc.cs
- GraphicsContext.cs
- Expressions.cs
- XmlSchemaSequence.cs
- SchemaTableColumn.cs
- StylusShape.cs
- Inline.cs
- clipboard.cs
- TaskHelper.cs
- ADRoleFactory.cs
- AccessDataSourceWizardForm.cs
- PerfCounterSection.cs
- ItemCollectionEditor.cs
- DetailsViewPagerRow.cs
- ParentQuery.cs
- WrapPanel.cs
- Brushes.cs
- OleDbTransaction.cs
- AppDomainGrammarProxy.cs
- RegistryConfigurationProvider.cs
- ValidatingReaderNodeData.cs
- CodeChecksumPragma.cs
- RichTextBox.cs
- GcSettings.cs
- SizeAnimation.cs