You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

57 lines
1.5 KiB

  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Controls.Primitives;
  9. using System.Windows.Input;
  10. namespace BPA.UIControl
  11. {
  12. /// <summary>
  13. /// 滑动视图子项
  14. /// </summary>
  15. public class FlipViewItem : ListBoxItem
  16. {
  17. static FlipViewItem()
  18. {
  19. DefaultStyleKeyProperty.OverrideMetadata(typeof(FlipViewItem), new FrameworkPropertyMetadata(typeof(FlipViewItem)));
  20. }
  21. /// <inheritdoc/>
  22. public override void OnApplyTemplate()
  23. {
  24. base.OnApplyTemplate();
  25. }
  26. /// <inheritdoc/>
  27. protected override void OnMouseLeftButtonDown(MouseButtonEventArgs e)
  28. {
  29. // 取消鼠标左键点击选择,改成右击
  30. base.OnMouseRightButtonDown(e);
  31. }
  32. #region properties
  33. /// <summary>
  34. /// 索引
  35. /// </summary>
  36. public static readonly DependencyProperty IndexProperty =
  37. DependencyProperty.Register("Index", typeof(int), typeof(FlipViewItem), new FrameworkPropertyMetadata(0, FrameworkPropertyMetadataOptions.BindsTwoWayByDefault));
  38. /// <summary>
  39. /// 索引
  40. /// </summary>
  41. public int Index
  42. {
  43. get { return (int)GetValue(IndexProperty); }
  44. set { SetValue(IndexProperty, value); }
  45. }
  46. #endregion
  47. }
  48. }