1010namespace AutoMidiPlayer . WPF . Controls ;
1111
1212/// <summary>
13- /// Reusable track list control for displaying MIDI files
13+ /// Reusable song list control for displaying MIDI files
1414/// </summary>
15- public partial class TrackListControl : UserControl
15+ public partial class SongListControl : UserControl
1616{
1717 #region Dependency Properties
1818
1919 /// <summary>
2020 /// Items to display in the list
2121 /// </summary>
2222 public static readonly DependencyProperty ItemsSourceProperty =
23- DependencyProperty . Register ( nameof ( ItemsSource ) , typeof ( IEnumerable ) , typeof ( TrackListControl ) ,
23+ DependencyProperty . Register ( nameof ( ItemsSource ) , typeof ( IEnumerable ) , typeof ( SongListControl ) ,
2424 new PropertyMetadata ( null ) ) ;
2525
2626 public IEnumerable ? ItemsSource
@@ -33,7 +33,7 @@ public IEnumerable? ItemsSource
3333 /// Currently selected item
3434 /// </summary>
3535 public static readonly DependencyProperty SelectedItemProperty =
36- DependencyProperty . Register ( nameof ( SelectedItem ) , typeof ( object ) , typeof ( TrackListControl ) ,
36+ DependencyProperty . Register ( nameof ( SelectedItem ) , typeof ( object ) , typeof ( SongListControl ) ,
3737 new FrameworkPropertyMetadata ( null , FrameworkPropertyMetadataOptions . BindsTwoWayByDefault ) ) ;
3838
3939 public object ? SelectedItem
@@ -46,7 +46,7 @@ public object? SelectedItem
4646 /// Currently opened/playing file (for highlighting)
4747 /// </summary>
4848 public static readonly DependencyProperty OpenedFileProperty =
49- DependencyProperty . Register ( nameof ( OpenedFile ) , typeof ( MidiFile ) , typeof ( TrackListControl ) ,
49+ DependencyProperty . Register ( nameof ( OpenedFile ) , typeof ( MidiFile ) , typeof ( SongListControl ) ,
5050 new PropertyMetadata ( null ) ) ;
5151
5252 public MidiFile ? OpenedFile
@@ -59,7 +59,7 @@ public MidiFile? OpenedFile
5959 /// Whether playback is currently active
6060 /// </summary>
6161 public static readonly DependencyProperty IsPlayingProperty =
62- DependencyProperty . Register ( nameof ( IsPlaying ) , typeof ( bool ) , typeof ( TrackListControl ) ,
62+ DependencyProperty . Register ( nameof ( IsPlaying ) , typeof ( bool ) , typeof ( SongListControl ) ,
6363 new PropertyMetadata ( false ) ) ;
6464
6565 public bool IsPlaying
@@ -72,7 +72,7 @@ public bool IsPlaying
7272 /// Whether drag-drop reordering is allowed
7373 /// </summary>
7474 public static readonly DependencyProperty AllowReorderProperty =
75- DependencyProperty . Register ( nameof ( AllowReorder ) , typeof ( bool ) , typeof ( TrackListControl ) ,
75+ DependencyProperty . Register ( nameof ( AllowReorder ) , typeof ( bool ) , typeof ( SongListControl ) ,
7676 new PropertyMetadata ( false ) ) ;
7777
7878 public bool AllowReorder
@@ -90,7 +90,7 @@ public bool AllowReorder
9090 /// Whether multiple items are currently selected
9191 /// </summary>
9292 public static readonly DependencyProperty IsMultiSelectProperty =
93- DependencyProperty . Register ( nameof ( IsMultiSelect ) , typeof ( bool ) , typeof ( TrackListControl ) ,
93+ DependencyProperty . Register ( nameof ( IsMultiSelect ) , typeof ( bool ) , typeof ( SongListControl ) ,
9494 new PropertyMetadata ( false ) ) ;
9595
9696 public bool IsMultiSelect
@@ -103,7 +103,7 @@ public bool IsMultiSelect
103103 /// Context menu to show for items
104104 /// </summary>
105105 public static readonly DependencyProperty ItemContextMenuProperty =
106- DependencyProperty . Register ( nameof ( ItemContextMenu ) , typeof ( ContextMenu ) , typeof ( TrackListControl ) ,
106+ DependencyProperty . Register ( nameof ( ItemContextMenu ) , typeof ( ContextMenu ) , typeof ( SongListControl ) ,
107107 new PropertyMetadata ( null , OnItemContextMenuChanged ) ) ;
108108
109109 public ContextMenu ? ItemContextMenu
@@ -114,11 +114,11 @@ public ContextMenu? ItemContextMenu
114114
115115 private static void OnItemContextMenuChanged ( DependencyObject d , DependencyPropertyChangedEventArgs e )
116116 {
117- if ( d is TrackListControl control && e . NewValue is ContextMenu menu )
117+ if ( d is SongListControl control && e . NewValue is ContextMenu menu )
118118 {
119- // Set the context menu on the ListView but ensure PlacementTarget points to the TrackListControl
119+ // Set the context menu on the ListView but ensure PlacementTarget points to the SongListControl
120120 control . TrackListView . ContextMenu = menu ;
121- // Set PlacementTarget to the TrackListControl so bindings like PlacementTarget.IsMultiSelect work
121+ // Set PlacementTarget to the SongListControl so bindings like PlacementTarget.IsMultiSelect work
122122 menu . PlacementTarget = control ;
123123 }
124124 }
@@ -132,7 +132,7 @@ private static void OnItemContextMenuChanged(DependencyObject d, DependencyPrope
132132 /// </summary>
133133 public static readonly RoutedEvent ItemDoubleClickEvent =
134134 EventManager . RegisterRoutedEvent ( nameof ( ItemDoubleClick ) , RoutingStrategy . Bubble ,
135- typeof ( RoutedEventHandler ) , typeof ( TrackListControl ) ) ;
135+ typeof ( RoutedEventHandler ) , typeof ( SongListControl ) ) ;
136136
137137 public event RoutedEventHandler ItemDoubleClick
138138 {
@@ -145,7 +145,7 @@ public event RoutedEventHandler ItemDoubleClick
145145 /// </summary>
146146 public static readonly RoutedEvent PlayPauseClickEvent =
147147 EventManager . RegisterRoutedEvent ( nameof ( PlayPauseClick ) , RoutingStrategy . Bubble ,
148- typeof ( RoutedEventHandler ) , typeof ( TrackListControl ) ) ;
148+ typeof ( RoutedEventHandler ) , typeof ( SongListControl ) ) ;
149149
150150 public event RoutedEventHandler PlayPauseClick
151151 {
@@ -158,7 +158,7 @@ public event RoutedEventHandler PlayPauseClick
158158 /// </summary>
159159 public static readonly RoutedEvent MenuClickEvent =
160160 EventManager . RegisterRoutedEvent ( nameof ( MenuClick ) , RoutingStrategy . Bubble ,
161- typeof ( RoutedEventHandler ) , typeof ( TrackListControl ) ) ;
161+ typeof ( RoutedEventHandler ) , typeof ( SongListControl ) ) ;
162162
163163 public event RoutedEventHandler MenuClick
164164 {
@@ -168,7 +168,7 @@ public event RoutedEventHandler MenuClick
168168
169169 #endregion
170170
171- public TrackListControl ( )
171+ public SongListControl ( )
172172 {
173173 InitializeComponent ( ) ;
174174 }
@@ -201,7 +201,7 @@ private void TrackListView_PreviewMouseDoubleClick(object sender, MouseButtonEve
201201 if ( element is ListViewItem item && item . Content is MidiFile file )
202202 {
203203 SelectedItem = file ;
204- RaiseEvent ( new TrackListEventArgs ( ItemDoubleClickEvent , this , file ) ) ;
204+ RaiseEvent ( new SongListEventArgs ( ItemDoubleClickEvent , this , file ) ) ;
205205 e . Handled = true ;
206206 }
207207 }
@@ -211,7 +211,7 @@ private void PlayPauseButton_PreviewMouseDown(object sender, MouseButtonEventArg
211211 if ( sender is Button button && button . Tag is MidiFile file )
212212 {
213213 SelectedItem = file ;
214- RaiseEvent ( new TrackListEventArgs ( PlayPauseClickEvent , this , file ) ) ;
214+ RaiseEvent ( new SongListEventArgs ( PlayPauseClickEvent , this , file ) ) ;
215215 e . Handled = true ;
216216 }
217217 }
@@ -227,7 +227,7 @@ private void MenuButton_PreviewMouseDown(object sender, MouseButtonEventArgs e)
227227 }
228228
229229 SelectedItem = file ;
230- RaiseEvent ( new TrackListEventArgs ( MenuClickEvent , this , file ) ) ;
230+ RaiseEvent ( new SongListEventArgs ( MenuClickEvent , this , file ) ) ;
231231
232232 // Open context menu if one is set
233233 if ( TrackListView . ContextMenu != null )
@@ -256,11 +256,11 @@ private void TrackListView_SelectionChanged(object sender, SelectionChangedEvent
256256/// <summary>
257257/// Event args that includes the clicked MidiFile
258258/// </summary>
259- public class TrackListEventArgs : RoutedEventArgs
259+ public class SongListEventArgs : RoutedEventArgs
260260{
261261 public MidiFile File { get ; }
262262
263- public TrackListEventArgs ( RoutedEvent routedEvent , object source , MidiFile file )
263+ public SongListEventArgs ( RoutedEvent routedEvent , object source , MidiFile file )
264264 : base ( routedEvent , source )
265265 {
266266 File = file ;
0 commit comments