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
- ApplicationManager.cs
- SvcMapFileSerializer.cs
- Point3DValueSerializer.cs
- XPathArrayIterator.cs
- DocumentReference.cs
- SQLDoubleStorage.cs
- SizeAnimationClockResource.cs
- DictionaryCustomTypeDescriptor.cs
- COM2ComponentEditor.cs
- SourceChangedEventArgs.cs
- validationstate.cs
- CardSpaceShim.cs
- DependencyPropertyAttribute.cs
- WindowsRichEdit.cs
- StrokeIntersection.cs
- ContextMenu.cs
- ListViewVirtualItemsSelectionRangeChangedEvent.cs
- ArgumentNullException.cs
- TemplateParser.cs
- ToolStripPanelSelectionBehavior.cs
- BaseDataListActionList.cs
- Assert.cs
- SystemTcpStatistics.cs
- UserValidatedEventArgs.cs
- Quack.cs
- TrackingAnnotationCollection.cs
- XmlBoundElement.cs
- XmlStringTable.cs
- NameTable.cs
- ZipIOZip64EndOfCentralDirectoryLocatorBlock.cs
- EntityClientCacheKey.cs
- DataObjectSettingDataEventArgs.cs
- FileInfo.cs
- HierarchicalDataSourceDesigner.cs
- AvtEvent.cs
- UnauthorizedAccessException.cs
- securitymgrsite.cs
- TabletDevice.cs
- BindingValueChangedEventArgs.cs
- IUnknownConstantAttribute.cs
- MemoryRecordBuffer.cs
- ProcessThread.cs
- SpotLight.cs
- StreamMarshaler.cs
- ArgumentOutOfRangeException.cs
- ChangePassword.cs
- FontWeights.cs
- WebPartsPersonalization.cs
- ImportContext.cs
- ObjectMaterializedEventArgs.cs
- WindowsGrip.cs
- OneToOneMappingSerializer.cs
- SQLInt16.cs
- NavigationFailedEventArgs.cs
- HttpServerVarsCollection.cs
- FillErrorEventArgs.cs
- TableLayoutPanelCodeDomSerializer.cs
- CharConverter.cs
- MobileControlsSection.cs
- BinaryWriter.cs
- HostProtectionException.cs
- AttributeEmitter.cs
- InfoCardX509Validator.cs
- ColorConvertedBitmap.cs
- ReversePositionQuery.cs
- HttpServerUtilityBase.cs
- GuidelineSet.cs
- HwndHost.cs
- Single.cs
- TypeListConverter.cs
- Compiler.cs
- HyperLinkColumn.cs
- HeaderUtility.cs
- HelpKeywordAttribute.cs
- ModifierKeysConverter.cs
- RangeValidator.cs
- CodeNamespaceCollection.cs
- WorkflowApplicationUnhandledExceptionEventArgs.cs
- BitmapEffectDrawing.cs
- ServicePointManagerElement.cs
- TimeSpanMinutesConverter.cs
- MetadataItemSerializer.cs
- ParserContext.cs
- ExpressionTextBox.xaml.cs
- FormViewPageEventArgs.cs
- EnumMemberAttribute.cs
- DbParameterHelper.cs
- RtfToXamlReader.cs
- _NestedMultipleAsyncResult.cs
- PageVisual.cs
- CacheEntry.cs
- QueryContext.cs
- Material.cs
- ImportContext.cs
- SiteMapDataSource.cs
- SingleObjectCollection.cs
- OracleCommand.cs
- ImageCodecInfoPrivate.cs
- ComponentDispatcherThread.cs
- TextCharacters.cs