|
using System;
using System.Collections.Generic;
using System.ComponentModel.Composition;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Input;
using MediaAssistant.DAL;
using System.Linq;
namespace MediaAssistant.Controls.MusicList
{
[Export(typeof(IMusicListView))]
public partial class MusicListView:IMusicListView
{
public MusicListView()
{
InitializeComponent();
}
public IEnumerable<Music> GetSelectedMusics()
{
return Grid.SelectedItems.Cast<Music>();
}
public void ScrollIntoView(Music music)
{
if (music != null)
Grid.ScrollIntoView(music);
}
private void HandleMouseDoubleClick(object sender, MouseButtonEventArgs e)
{
var element = e.OriginalSource as FrameworkElement;
if(element.DataContext is Music)
{
var selectedItem = Grid.SelectedItem as Music;
if (selectedItem != null)
((MusicListPresenter) DataContext).OnItemDoubleClicked(selectedItem);
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.