/Application/GUI/Controls/EnhancedSlider.xaml.cs

http://yet-another-music-application.googlecode.com/ · C# · 89 lines · 59 code · 13 blank · 17 comment · 0 complexity · 083dc1c006b468b5b93b3b7e4765de30 MD5 · raw file

  1. using System;
  2. using System.Collections.Generic;
  3. using System.ComponentModel;
  4. using System.Linq;
  5. using System.Text;
  6. using System.Windows;
  7. using System.Windows.Controls;
  8. using System.Windows.Data;
  9. using System.Windows.Documents;
  10. using System.Windows.Input;
  11. using System.Windows.Media;
  12. using System.Windows.Media.Imaging;
  13. using System.Windows.Navigation;
  14. using System.Windows.Shapes;
  15. namespace Stoffi
  16. {
  17. /// <summary>
  18. /// Interaction logic for EnhancedSlider.xaml
  19. /// </summary>
  20. public partial class EnhancedSlider : Slider
  21. {
  22. #region Members
  23. #endregion
  24. #region Properties
  25. /// <summary>
  26. /// Gets or sets the second value of the slider.
  27. /// It will only show if it is higher than Value.
  28. /// </summary>
  29. public double SecondValue
  30. {
  31. get
  32. {
  33. return (SecondValueWidth / ActualWidth) * Maximum;
  34. }
  35. set
  36. {
  37. SecondValueWidth = ActualWidth * (value / Maximum);
  38. }
  39. }
  40. /// <summary>
  41. /// Gets or sets the actual width (in pixels) of the
  42. /// second value indicator.
  43. /// </summary>
  44. public double SecondValueWidth
  45. {
  46. get
  47. {
  48. return (double)GetValue(SecondValueWidthProperty);
  49. }
  50. set
  51. {
  52. SetValue(SecondValueWidthProperty, value);
  53. }
  54. }
  55. /// <summary>
  56. /// The DependencyProperty for SecondValueWidth
  57. /// </summary>
  58. public static readonly DependencyProperty SecondValueWidthProperty =
  59. DependencyProperty.Register("SecondValueWidth", typeof(double), typeof(EnhancedSlider), new UIPropertyMetadata(0.0));
  60. #endregion
  61. #region Constructor
  62. /// <summary>
  63. /// Creates an instance of a Slider.
  64. /// </summary>
  65. public EnhancedSlider()
  66. {
  67. U.L(LogLevel.Debug, "ENHANCED SLIDER", "Initialize");
  68. InitializeComponent();
  69. U.L(LogLevel.Debug, "ENHANCED SLIDER", "Initialized");
  70. DataContext = this;
  71. }
  72. #endregion
  73. #region Methods
  74. #endregion
  75. }
  76. }