Code:
/ 4.0 / 4.0 / untmp / DEVDIV_TFS / Dev10 / Releases / RTMRel / wpf / src / Framework / System / Windows / Controls / AlternationConverter.cs / 1305600 / 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
- LinqDataSourceInsertEventArgs.cs
- UdpUtility.cs
- serverconfig.cs
- ChangeToolStripParentVerb.cs
- ListViewUpdateEventArgs.cs
- SoapFault.cs
- nulltextnavigator.cs
- JavascriptXmlWriterWrapper.cs
- SpAudioStreamWrapper.cs
- Int16Animation.cs
- GenericIdentity.cs
- ValidatingReaderNodeData.cs
- RequestQueue.cs
- PointF.cs
- SmtpException.cs
- UnsafeNativeMethods.cs
- CodeGroup.cs
- AssociationEndMember.cs
- SqlDataSourceCache.cs
- InstanceHandleReference.cs
- EnumerableRowCollectionExtensions.cs
- WebPartMenuStyle.cs
- GetPageNumberCompletedEventArgs.cs
- VisualBasicDesignerHelper.cs
- DataGridRowsPresenter.cs
- ColorContext.cs
- ComponentDispatcher.cs
- SmtpException.cs
- XmlSchemaAll.cs
- DropDownList.cs
- AggregatePushdown.cs
- WindowExtensionMethods.cs
- XNodeNavigator.cs
- MetadataItem_Static.cs
- SecurityTokenProviderContainer.cs
- DescriptionCreator.cs
- AtlasWeb.Designer.cs
- DesignerEventService.cs
- DocumentPageViewAutomationPeer.cs
- PersonalizationProviderCollection.cs
- VirtualDirectoryMappingCollection.cs
- CorrelationQueryBehavior.cs
- ThumbAutomationPeer.cs
- SecurityChannelListener.cs
- FederatedMessageSecurityOverHttpElement.cs
- DataServiceExpressionVisitor.cs
- SlipBehavior.cs
- ElementAtQueryOperator.cs
- SoapCodeExporter.cs
- ToolStripDropDownButton.cs
- DispatcherTimer.cs
- CaseInsensitiveHashCodeProvider.cs
- SchemaAttDef.cs
- TripleDESCryptoServiceProvider.cs
- WindowsSysHeader.cs
- ElementMarkupObject.cs
- HttpsHostedTransportConfiguration.cs
- PolyBezierSegmentFigureLogic.cs
- DataListGeneralPage.cs
- Int64AnimationUsingKeyFrames.cs
- FunctionNode.cs
- Simplifier.cs
- ZoneIdentityPermission.cs
- AssociationSetEnd.cs
- XmlEventCache.cs
- Math.cs
- InstanceData.cs
- PhoneCall.cs
- BuildProviderCollection.cs
- TypeBuilder.cs
- ByteConverter.cs
- NavigationPropertyEmitter.cs
- AsmxEndpointPickerExtension.cs
- Ref.cs
- WinOEToolBoxItem.cs
- SizeConverter.cs
- _ListenerAsyncResult.cs
- SimpleHandlerFactory.cs
- ToolbarAUtomationPeer.cs
- FieldNameLookup.cs
- XmlJsonWriter.cs
- InputEventArgs.cs
- DaylightTime.cs
- TdsParameterSetter.cs
- FileLogRecordEnumerator.cs
- CompilationUnit.cs
- ColorConverter.cs
- ReturnType.cs
- PageTrueTypeFont.cs
- DefaultTextStore.cs
- WebPartConnectionsEventArgs.cs
- IndividualDeviceConfig.cs
- ObjectDataSourceMethodEventArgs.cs
- Rect.cs
- ASCIIEncoding.cs
- BitmapVisualManager.cs
- ProfileManager.cs
- TextSelectionHelper.cs
- WorkflowInstanceRecord.cs
- ParallelTimeline.cs