Code:
/ Net / Net / 3.5.50727.3053 / DEVDIV / depot / DevDiv / releases / Orcas / SP / wpf / src / Framework / System / Windows / Controls / AlternationConverter.cs / 1 / AlternationConverter.cs
//---------------------------------------------------------------------------- // //// Copyright (C) by Microsoft Corporation. All rights reserved. // // // Description: Convert between index and a list of values. // //--------------------------------------------------------------------------- using System; using System.Collections; using System.Collections.Generic; using System.Globalization; using System.Windows.Data; using System.Windows.Markup; namespace System.Windows.Controls { ////// AlternationConverter is intended to be used by a binding to the /// ItemsControl.AlternationIndex attached property. It converts an integer /// into the corresponding item in Values list. /// [ContentProperty("Values")] public class AlternationConverter : IValueConverter { ////// A list of values. /// public IList Values { get { return _values; } } /// /// Convert an integer to the corresponding value from the Values list. /// public object Convert (object o, Type targetType, object parameter, CultureInfo culture) { if (_values.Count > 0 && o is int) { int index = ((int)o) % _values.Count; if (index < 0) // Adjust for incorrect definition of the %-operator for negative arguments. index += _values.Count; return _values[index]; } return DependencyProperty.UnsetValue; } ////// Convert an object to the index in the Values list at which that object appears. /// If the object is not in the Values list, return -1. /// public object ConvertBack(object o, Type targetType, object parameter, CultureInfo culture) { return _values.IndexOf(o); } List
Link Menu

This book is available now!
Buy at Amazon US or
Buy at Amazon UK
- COM2TypeInfoProcessor.cs
- HeaderCollection.cs
- HtmlTextArea.cs
- cookieexception.cs
- DbParameterCollection.cs
- KeyValuePair.cs
- ImageCodecInfo.cs
- contentDescriptor.cs
- IndexOutOfRangeException.cs
- ImplicitInputBrush.cs
- TaskHelper.cs
- InstanceKeyNotReadyException.cs
- LayoutTable.cs
- WebPartDisplayModeCancelEventArgs.cs
- DataTrigger.cs
- HttpPostedFileBase.cs
- DynamicPropertyReader.cs
- DispatchWrapper.cs
- DataServiceRequest.cs
- MappingSource.cs
- HttpException.cs
- CalendarDataBindingHandler.cs
- DataStreamFromComStream.cs
- NumberSubstitution.cs
- ContentDisposition.cs
- SwitchAttribute.cs
- ModuleBuilderData.cs
- CellQuery.cs
- AnnotationStore.cs
- Helpers.cs
- DiscoveryReferences.cs
- WebErrorHandler.cs
- BaseInfoTable.cs
- DataBinder.cs
- MetadataFile.cs
- WorkerRequest.cs
- SourceElementsCollection.cs
- RsaKeyGen.cs
- Grammar.cs
- LifetimeServices.cs
- RetrieveVirtualItemEventArgs.cs
- DmlSqlGenerator.cs
- ReadOnlyCollectionBase.cs
- ScriptModule.cs
- ProtocolsConfigurationHandler.cs
- ReferencedType.cs
- ArrangedElementCollection.cs
- DataBindingsDialog.cs
- QueryCacheKey.cs
- NegationPusher.cs
- SelectionGlyph.cs
- ToggleProviderWrapper.cs
- TabControl.cs
- PolicyStatement.cs
- InternalControlCollection.cs
- PeerInputChannelListener.cs
- ServiceOperationParameter.cs
- columnmapkeybuilder.cs
- DbProviderFactory.cs
- XmlReflectionImporter.cs
- ContainerActivationHelper.cs
- _Win32.cs
- WebDescriptionAttribute.cs
- FailedToStartupUIException.cs
- DefaultAsyncDataDispatcher.cs
- DateTimeValueSerializer.cs
- MultipartContentParser.cs
- LiteralText.cs
- PresentationAppDomainManager.cs
- DialogResultConverter.cs
- Configuration.cs
- MinMaxParagraphWidth.cs
- LedgerEntry.cs
- ParserOptions.cs
- And.cs
- WebEventTraceProvider.cs
- CompiledIdentityConstraint.cs
- ParameterCollection.cs
- NamedPipeActivation.cs
- SerializationAttributes.cs
- KeysConverter.cs
- XmlQuerySequence.cs
- Bitmap.cs
- HtmlTextBoxAdapter.cs
- WebScriptMetadataMessageEncodingBindingElement.cs
- ConfigurationException.cs
- recordstate.cs
- TemplateControlParser.cs
- DataBoundControlActionList.cs
- ViewSimplifier.cs
- SystemMulticastIPAddressInformation.cs
- ImageIndexConverter.cs
- MatchAttribute.cs
- PathData.cs
- IntSecurity.cs
- Resources.Designer.cs
- QueryResponse.cs
- CharacterBuffer.cs
- UnsafeNativeMethodsPenimc.cs
- UserPersonalizationStateInfo.cs