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
- GeometryModel3D.cs
- XhtmlConformanceSection.cs
- EventLogPermission.cs
- SafeFileHandle.cs
- EntityModelBuildProvider.cs
- CSharpCodeProvider.cs
- NameTable.cs
- Geometry.cs
- XmlWellformedWriter.cs
- HandlerBase.cs
- SchemaSetCompiler.cs
- CellParaClient.cs
- ToggleProviderWrapper.cs
- safelink.cs
- PageBuildProvider.cs
- PopupEventArgs.cs
- BaseDataListPage.cs
- DataChangedEventManager.cs
- MatrixAnimationUsingPath.cs
- XmlObjectSerializerWriteContext.cs
- ImageList.cs
- TextEffectResolver.cs
- RouteTable.cs
- URIFormatException.cs
- DPCustomTypeDescriptor.cs
- MemberInitExpression.cs
- OleDbInfoMessageEvent.cs
- HttpModule.cs
- OperationValidationEventArgs.cs
- XhtmlBasicLiteralTextAdapter.cs
- StrokeRenderer.cs
- HttpInputStream.cs
- DataGridViewAdvancedBorderStyle.cs
- ToolTip.cs
- CreateParams.cs
- controlskin.cs
- MailMessageEventArgs.cs
- RtType.cs
- DataBoundLiteralControl.cs
- TypeExtension.cs
- FilteredXmlReader.cs
- SelectionEditor.cs
- RectangleHotSpot.cs
- PlainXmlDeserializer.cs
- EntityAdapter.cs
- WebConfigurationHostFileChange.cs
- SQLByte.cs
- WorkflowElementDialogWindow.xaml.cs
- DynamicRendererThreadManager.cs
- HtmlInputReset.cs
- HttpRuntime.cs
- StaticExtensionConverter.cs
- OverlappedAsyncResult.cs
- GridViewCancelEditEventArgs.cs
- TraceFilter.cs
- LineServicesCallbacks.cs
- ToolZone.cs
- SingleSelectRootGridEntry.cs
- ElementFactory.cs
- WindowsListViewGroup.cs
- ConsoleKeyInfo.cs
- COM2ExtendedBrowsingHandler.cs
- ContainerFilterService.cs
- TriggerBase.cs
- XmlSerializerVersionAttribute.cs
- BufferedWebEventProvider.cs
- SortDescription.cs
- ParameterInfo.cs
- SynchronizedPool.cs
- ReadOnlyTernaryTree.cs
- ArrayList.cs
- IOThreadTimer.cs
- TextRange.cs
- XmlExceptionHelper.cs
- ItemCollection.cs
- XmlNamespaceDeclarationsAttribute.cs
- ThumbButtonInfoCollection.cs
- ObjectViewEntityCollectionData.cs
- IfAction.cs
- RequestTimeoutManager.cs
- ConfigurationSettings.cs
- Popup.cs
- MobileCategoryAttribute.cs
- ProgressBar.cs
- KnownBoxes.cs
- XpsFilter.cs
- ObjectConverter.cs
- InputElement.cs
- CachedFontFace.cs
- DefaultParameterValueAttribute.cs
- TraceContextRecord.cs
- FormViewRow.cs
- AudienceUriMode.cs
- HtmlElementEventArgs.cs
- DataListCommandEventArgs.cs
- OleDbException.cs
- ResolveDuplexAsyncResult.cs
- propertytag.cs
- PathFigure.cs
- ExpandSegment.cs