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
- TransactedBatchingElement.cs
- HostedHttpTransportManager.cs
- CallbackValidator.cs
- IxmlLineInfo.cs
- TransactionFormatter.cs
- SoapConverter.cs
- SafeRightsManagementSessionHandle.cs
- InputMethodStateTypeInfo.cs
- TextParagraphProperties.cs
- Rectangle.cs
- Span.cs
- DesignerDataSchemaClass.cs
- HandlerBase.cs
- ZipIOModeEnforcingStream.cs
- AuthenticationService.cs
- OdbcConnection.cs
- documentsequencetextview.cs
- ItemsControl.cs
- MethodBuilderInstantiation.cs
- Version.cs
- GridLengthConverter.cs
- BooleanToSelectiveScrollingOrientationConverter.cs
- Attribute.cs
- PolyBezierSegment.cs
- StringComparer.cs
- SystemIcons.cs
- WebRequest.cs
- RSAOAEPKeyExchangeDeformatter.cs
- ComponentEditorForm.cs
- Metafile.cs
- UmAlQuraCalendar.cs
- BlockUIContainer.cs
- EntityClientCacheKey.cs
- ServiceMemoryGates.cs
- DtrList.cs
- OciHandle.cs
- TypeLoadException.cs
- CssClassPropertyAttribute.cs
- EmbeddedMailObjectsCollection.cs
- TrackingMemoryStreamFactory.cs
- ToolStripContainer.cs
- XmlSchemaSimpleContent.cs
- Frame.cs
- NamedElement.cs
- DataTableReaderListener.cs
- XamlFrame.cs
- TrimSurroundingWhitespaceAttribute.cs
- ServicePointManager.cs
- HttpResponseBase.cs
- TimeSpanOrInfiniteConverter.cs
- RegexWorker.cs
- SpotLight.cs
- ModulesEntry.cs
- TransactionScope.cs
- TextUtf8RawTextWriter.cs
- TransformDescriptor.cs
- SingleKeyFrameCollection.cs
- BaseAppDomainProtocolHandler.cs
- HitTestDrawingContextWalker.cs
- Documentation.cs
- CAGDesigner.cs
- CachedTypeface.cs
- CurrencyManager.cs
- FamilyMap.cs
- PathSegmentCollection.cs
- DefinitionBase.cs
- StorageMappingItemLoader.cs
- TimeoutHelper.cs
- DataView.cs
- SystemDropShadowChrome.cs
- ServiceProviders.cs
- MSAAEventDispatcher.cs
- VerticalConnector.xaml.cs
- DataContractJsonSerializer.cs
- RelationshipSet.cs
- SafeEventHandle.cs
- HtmlTextArea.cs
- ProvidersHelper.cs
- CodeCommentStatement.cs
- StringInfo.cs
- WebPartConnectionsCloseVerb.cs
- IPAddress.cs
- ToolTipAutomationPeer.cs
- OdbcDataReader.cs
- BuilderPropertyEntry.cs
- DCSafeHandle.cs
- ExpressionBuilder.cs
- DataGridTextBox.cs
- FileBasedResourceGroveler.cs
- ShaderEffect.cs
- DataGridViewColumnTypeEditor.cs
- SocketPermission.cs
- HttpException.cs
- GridItemProviderWrapper.cs
- SmtpDigestAuthenticationModule.cs
- EventProxy.cs
- WindowsSpinner.cs
- LayeredChannelListener.cs
- VectorAnimationUsingKeyFrames.cs
- XmlQueryRuntime.cs