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
- SelectionRange.cs
- CodeArgumentReferenceExpression.cs
- Int16AnimationUsingKeyFrames.cs
- CodeTypeConstructor.cs
- _HTTPDateParse.cs
- XamlNamespaceHelper.cs
- SerializationObjectManager.cs
- ValueChangedEventManager.cs
- RadioButtonPopupAdapter.cs
- thaishape.cs
- selecteditemcollection.cs
- FigureHelper.cs
- ClientScriptManager.cs
- CompositeKey.cs
- BroadcastEventHelper.cs
- ThrowHelper.cs
- TextSearch.cs
- Resources.Designer.cs
- InstallerTypeAttribute.cs
- ShimAsPublicXamlType.cs
- Focus.cs
- MemoryRecordBuffer.cs
- BufferBuilder.cs
- GetPageNumberCompletedEventArgs.cs
- SiteMembershipCondition.cs
- SortQuery.cs
- SqlTopReducer.cs
- DisplayMemberTemplateSelector.cs
- TextModifier.cs
- CompoundFileReference.cs
- FilteredXmlReader.cs
- JavaScriptObjectDeserializer.cs
- WebBrowserEvent.cs
- SqlConnectionString.cs
- SafeArrayRankMismatchException.cs
- EmissiveMaterial.cs
- UmAlQuraCalendar.cs
- PropertyChangedEventArgs.cs
- PassportAuthenticationModule.cs
- WmlCommandAdapter.cs
- _ConnectionGroup.cs
- DataListItem.cs
- DesignerGeometryHelper.cs
- DecimalSumAggregationOperator.cs
- RuleRef.cs
- ChtmlTextWriter.cs
- SecureStringHasher.cs
- Assembly.cs
- Constraint.cs
- ISCIIEncoding.cs
- TextTabProperties.cs
- HtmlElementCollection.cs
- MatchingStyle.cs
- NameValuePair.cs
- TextServicesLoader.cs
- ScriptIgnoreAttribute.cs
- UnsignedPublishLicense.cs
- SamlAttributeStatement.cs
- GridItemPatternIdentifiers.cs
- FunctionQuery.cs
- SafeRightsManagementQueryHandle.cs
- EastAsianLunisolarCalendar.cs
- TraceShell.cs
- CacheVirtualItemsEvent.cs
- SelectedGridItemChangedEvent.cs
- WebBrowserSiteBase.cs
- shaperfactory.cs
- XmlDeclaration.cs
- HMAC.cs
- ConstraintEnumerator.cs
- XmlSchemaSimpleContentExtension.cs
- OdbcEnvironmentHandle.cs
- HttpListenerResponse.cs
- PageCatalogPartDesigner.cs
- MemberRelationshipService.cs
- SystemPens.cs
- Button.cs
- LayoutEvent.cs
- AcceleratedTokenProvider.cs
- SimpleBitVector32.cs
- XmlTextReaderImpl.cs
- File.cs
- TypeInfo.cs
- TableMethodGenerator.cs
- XmlIlGenerator.cs
- MatrixConverter.cs
- StreamGeometryContext.cs
- BaseTemplateParser.cs
- datacache.cs
- LogicalExpressionEditor.cs
- DbConnectionPoolGroup.cs
- WebZone.cs
- SQLInt32.cs
- DataServiceQuery.cs
- FontCollection.cs
- InlinedLocationReference.cs
- FormsAuthenticationEventArgs.cs
- UIntPtr.cs
- XhtmlBasicTextViewAdapter.cs
- OpenTypeCommon.cs