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
- Boolean.cs
- ReflectionTypeLoadException.cs
- TypeDescriptionProvider.cs
- LayoutSettings.cs
- HttpResponseBase.cs
- PopupRootAutomationPeer.cs
- SqlDependencyUtils.cs
- OleDbParameter.cs
- BooleanFacetDescriptionElement.cs
- XmlNodeList.cs
- ContentDisposition.cs
- AttachmentService.cs
- Random.cs
- SamlAssertion.cs
- InternalBufferOverflowException.cs
- EventDrivenDesigner.cs
- PolyLineSegmentFigureLogic.cs
- SecurityCredentialsManager.cs
- IPipelineRuntime.cs
- TableLayoutRowStyleCollection.cs
- EntityDataSourceState.cs
- MailWebEventProvider.cs
- CustomAttribute.cs
- TextRangeEditLists.cs
- PasswordBox.cs
- CodeBinaryOperatorExpression.cs
- HitTestWithPointDrawingContextWalker.cs
- ItemAutomationPeer.cs
- CellTreeNodeVisitors.cs
- EventSinkActivity.cs
- DesignerExtenders.cs
- GcSettings.cs
- ToolboxItemCollection.cs
- ToolStripItemImageRenderEventArgs.cs
- DataGridRowAutomationPeer.cs
- CodeMethodReturnStatement.cs
- TypefaceMap.cs
- HostingPreferredMapPath.cs
- PopupRootAutomationPeer.cs
- ResourceCategoryAttribute.cs
- DecimalAnimationUsingKeyFrames.cs
- metrodevice.cs
- XmlCodeExporter.cs
- FunctionNode.cs
- SystemColorTracker.cs
- SHA512Managed.cs
- XmlReflectionImporter.cs
- InputReferenceExpression.cs
- SocketPermission.cs
- IgnoreDeviceFilterElementCollection.cs
- TreeNodeConverter.cs
- WebUtil.cs
- SqlVisitor.cs
- UserMapPath.cs
- XmlSchemaDatatype.cs
- PinnedBufferMemoryStream.cs
- UserPreferenceChangedEventArgs.cs
- EntityTypeEmitter.cs
- FieldBuilder.cs
- ResumeStoryboard.cs
- ToolStripMenuItem.cs
- TimelineCollection.cs
- AssociatedControlConverter.cs
- HttpCacheVaryByContentEncodings.cs
- TableLayoutStyle.cs
- CompleteWizardStep.cs
- SetStoryboardSpeedRatio.cs
- XmlHierarchicalEnumerable.cs
- GenericTypeParameterConverter.cs
- PixelShader.cs
- AsyncCompletedEventArgs.cs
- EdmMember.cs
- AccessorTable.cs
- StreamWriter.cs
- PrintingPermissionAttribute.cs
- Opcode.cs
- TreeViewBindingsEditorForm.cs
- XmlSchemaAnnotated.cs
- Label.cs
- DropDownButton.cs
- BoolExpressionVisitors.cs
- PositiveTimeSpanValidator.cs
- CryptoStream.cs
- SessionEndingEventArgs.cs
- FrameworkElementAutomationPeer.cs
- BitmapEffectDrawing.cs
- EncodingTable.cs
- SqlDataSourceConfigureSelectPanel.cs
- VerificationAttribute.cs
- BitVector32.cs
- securitymgrsite.cs
- TextBox.cs
- Pair.cs
- PropertyOverridesTypeEditor.cs
- LocalServiceSecuritySettings.cs
- ParameterModifier.cs
- ExpressionReplacer.cs
- DetailsViewUpdateEventArgs.cs
- ToggleProviderWrapper.cs
- UrlPath.cs