ISelectionAdapter.cs 2.7 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273
  1. // (c) Copyright Microsoft Corporation.
  2. // This source is subject to the Microsoft Public License (Ms-PL).
  3. // Please see http://go.microsoft.com/fwlink/?LinkID=131993] for details.
  4. // All other rights reserved.
  5. using System.Collections;
  6. using System.Windows;
  7. using System.Windows.Automation.Peers;
  8. using System.Windows.Controls;
  9. using System.Windows.Input;
  10. namespace System.Windows.Controls
  11. {
  12. /// <summary>
  13. /// Defines an item collection, selection members, and key handling for the
  14. /// selection adapter contained in the drop-down portion of an
  15. /// <see cref="T:System.Windows.Controls.AutoCompleteBox" /> control.
  16. /// </summary>
  17. /// <QualityBand>Stable</QualityBand>
  18. public interface ISelectionAdapter
  19. {
  20. /// <summary>
  21. /// Gets or sets the selected item.
  22. /// </summary>
  23. /// <value>The currently selected item.</value>
  24. object SelectedItem { get; set; }
  25. /// <summary>
  26. /// Occurs when the
  27. /// <see cref="P:System.Windows.Controls.ISelectionAdapter.SelectedItem" />
  28. /// property value changes.
  29. /// </summary>
  30. event SelectionChangedEventHandler SelectionChanged;
  31. /// <summary>
  32. /// Gets or sets a collection that is used to generate content for the
  33. /// selection adapter.
  34. /// </summary>
  35. /// <value>The collection that is used to generate content for the
  36. /// selection adapter.</value>
  37. IEnumerable ItemsSource { get; set; }
  38. /// <summary>
  39. /// Occurs when a selected item is not cancelled and is committed as the
  40. /// selected item.
  41. /// </summary>
  42. event RoutedEventHandler Commit;
  43. /// <summary>
  44. /// Occurs when a selection has been canceled.
  45. /// </summary>
  46. event RoutedEventHandler Cancel;
  47. /// <summary>
  48. /// Provides handling for the
  49. /// <see cref="E:System.Windows.UIElement.KeyDown" /> event that occurs
  50. /// when a key is pressed while the drop-down portion of the
  51. /// <see cref="T:System.Windows.Controls.AutoCompleteBox" /> has focus.
  52. /// </summary>
  53. /// <param name="e">A <see cref="T:System.Windows.Input.KeyEventArgs" />
  54. /// that contains data about the
  55. /// <see cref="E:System.Windows.UIElement.KeyDown" /> event.</param>
  56. void HandleKeyDown(KeyEventArgs e);
  57. /// <summary>
  58. /// Returns an automation peer for the selection adapter, for use by the
  59. /// Silverlight automation infrastructure.
  60. /// </summary>
  61. /// <returns>An automation peer for the selection adapter, if one is
  62. /// available; otherwise, null.</returns>
  63. AutomationPeer CreateAutomationPeer();
  64. }
  65. }