Code:
/ Dotnetfx_Vista_SP2 / Dotnetfx_Vista_SP2 / 8.0.50727.4016 / DEVDIV / depot / DevDiv / releases / Orcas / QFE / 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
- OleDbDataReader.cs
- ConnectionPointCookie.cs
- GenericsInstances.cs
- WindowsStatic.cs
- MenuItemStyleCollection.cs
- PathGradientBrush.cs
- Task.cs
- connectionpool.cs
- SoapFormatter.cs
- DecoderNLS.cs
- QueryPageSettingsEventArgs.cs
- ClientFormsIdentity.cs
- Screen.cs
- IsolatedStorageFileStream.cs
- LocalizeDesigner.cs
- PhysicalAddress.cs
- DesignObjectWrapper.cs
- UnsafeCollabNativeMethods.cs
- XsltConvert.cs
- PropertyDescriptorGridEntry.cs
- DataListItemCollection.cs
- ImageKeyConverter.cs
- SessionPageStateSection.cs
- EnvelopedPkcs7.cs
- ValidationErrorEventArgs.cs
- MarkupExtensionParser.cs
- DefaultValueMapping.cs
- MarshalDirectiveException.cs
- TableParagraph.cs
- TextTreeTextNode.cs
- RegisteredScript.cs
- Int64AnimationUsingKeyFrames.cs
- PngBitmapEncoder.cs
- ActionItem.cs
- HtmlElement.cs
- SerializationInfo.cs
- XmlSigningNodeWriter.cs
- RegistryKey.cs
- ScriptingJsonSerializationSection.cs
- ListViewCommandEventArgs.cs
- TextFormatterContext.cs
- MsmqIntegrationProcessProtocolHandler.cs
- UrlMapping.cs
- UpdatePanel.cs
- basecomparevalidator.cs
- Dump.cs
- XmlSchemaInfo.cs
- FormatControl.cs
- SelectionBorderGlyph.cs
- ManagedCodeMarkers.cs
- XmlSignificantWhitespace.cs
- XmlSchemaDatatype.cs
- AssociationSetEnd.cs
- RadioButtonStandardAdapter.cs
- CqlIdentifiers.cs
- CachedFontFace.cs
- PersonalizableTypeEntry.cs
- ComponentEvent.cs
- WbemException.cs
- BitmapEffectInputData.cs
- WebBaseEventKeyComparer.cs
- VisualBrush.cs
- Menu.cs
- Zone.cs
- CellParagraph.cs
- IncrementalCompileAnalyzer.cs
- CompensatableSequenceActivity.cs
- CellRelation.cs
- AnchorEditor.cs
- PrimarySelectionAdorner.cs
- CheckBox.cs
- KeyInterop.cs
- DrawListViewSubItemEventArgs.cs
- WindowsFormsHostPropertyMap.cs
- Pair.cs
- SQLUtility.cs
- WebPartMenu.cs
- SerTrace.cs
- XslVisitor.cs
- RuleInfoComparer.cs
- RecommendedAsConfigurableAttribute.cs
- InputScopeNameConverter.cs
- BooleanFacetDescriptionElement.cs
- UriParserTemplates.cs
- ZipIOZip64EndOfCentralDirectoryBlock.cs
- CodeTypeDeclarationCollection.cs
- CallSite.cs
- SourceChangedEventArgs.cs
- PathGradientBrush.cs
- DataControlExtensions.cs
- GB18030Encoding.cs
- ContentPosition.cs
- FileRegion.cs
- WebAdminConfigurationHelper.cs
- KeyedHashAlgorithm.cs
- ComponentEditorPage.cs
- SubqueryRules.cs
- ConfigurationFileMap.cs
- SmiEventSink_DeferedProcessing.cs
- HTTPNotFoundHandler.cs