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
- ProxyWebPartConnectionCollection.cs
- UserMapPath.cs
- IResourceProvider.cs
- ServiceBuildProvider.cs
- BitmapEffectGeneralTransform.cs
- WebPartConnectionsConnectVerb.cs
- RoutedUICommand.cs
- InfoCardRSAPKCS1KeyExchangeDeformatter.cs
- FolderLevelBuildProviderAppliesToAttribute.cs
- DataGridHeaderBorder.cs
- ConsoleKeyInfo.cs
- MetadataPropertyvalue.cs
- ProviderSettingsCollection.cs
- CompilationLock.cs
- CollaborationHelperFunctions.cs
- NativeMethods.cs
- _ScatterGatherBuffers.cs
- RequestQueryProcessor.cs
- BrowserCapabilitiesFactory35.cs
- Type.cs
- IriParsingElement.cs
- ArrangedElementCollection.cs
- Matrix.cs
- CacheHelper.cs
- OleDbPropertySetGuid.cs
- FrameworkElementAutomationPeer.cs
- DefaultParameterValueAttribute.cs
- MaterializeFromAtom.cs
- XmlAttributeAttribute.cs
- FieldMetadata.cs
- WebPartEditVerb.cs
- RegionIterator.cs
- LayoutTable.cs
- ComplexTypeEmitter.cs
- HttpModuleAction.cs
- ChannelSinkStacks.cs
- XmlTypeMapping.cs
- SystemKeyConverter.cs
- webclient.cs
- StylusLogic.cs
- WorkflowOperationAsyncResult.cs
- PathNode.cs
- VirtualizingPanel.cs
- XhtmlTextWriter.cs
- Span.cs
- CodeValidator.cs
- SelectionItemPattern.cs
- DoubleCollection.cs
- Helper.cs
- XmlStreamStore.cs
- CircleHotSpot.cs
- httpstaticobjectscollection.cs
- Automation.cs
- SemaphoreSlim.cs
- XmlQueryTypeFactory.cs
- DesigntimeLicenseContextSerializer.cs
- ClientSettingsProvider.cs
- Tokenizer.cs
- InheritanceContextHelper.cs
- httpserverutility.cs
- PartialTrustHelpers.cs
- AsyncPostBackTrigger.cs
- ColumnPropertiesGroup.cs
- SqlFactory.cs
- ProfileBuildProvider.cs
- XmlDocumentFragment.cs
- MulticastDelegate.cs
- TableColumnCollection.cs
- XmlNavigatorStack.cs
- ReferenceConverter.cs
- SecurityChannelFaultConverter.cs
- TdsParserStateObject.cs
- TextOnlyOutput.cs
- SeparatorAutomationPeer.cs
- ProfileSection.cs
- SingleObjectCollection.cs
- CodeValidator.cs
- HandleCollector.cs
- CollectionChangedEventManager.cs
- StorageModelBuildProvider.cs
- WebException.cs
- ResolveResponse.cs
- CompilerResults.cs
- XmlAutoDetectWriter.cs
- BinaryObjectInfo.cs
- PageSetupDialog.cs
- HostExecutionContextManager.cs
- NegationPusher.cs
- DataControlPagerLinkButton.cs
- metadatamappinghashervisitor.hashsourcebuilder.cs
- DropShadowEffect.cs
- CapabilitiesRule.cs
- basemetadatamappingvisitor.cs
- InternalUserCancelledException.cs
- TextBoxRenderer.cs
- CompatibleComparer.cs
- Journaling.cs
- Faults.cs
- ManualResetEvent.cs
- FixedPageStructure.cs