Exemplo n.º 1
0
        // load songs into the grid
        async void BindITunesGrid()
        {
            // load songs
            _songs = await MediaLibraryStorage.Load();

            // build view
            var view = new C1.Xaml.C1CollectionView(_songs);

            view.GroupDescriptions.Add(new C1.Xaml.PropertyGroupDescription("Artist"));
            view.GroupDescriptions.Add(new C1.Xaml.PropertyGroupDescription("Album"));

            // configure grid
            var fg = _flexMedia;

            fg.CellFactory  = new MusicCellFactory();
            fg.MergeManager = null; // << review this, should not merge cells with content
            fg.Columns["Duration"].ValueConverter = new SongDurationConverter();
            fg.Columns["Size"].ValueConverter     = new SongSizeConverter();
            fg.ItemsSource = view;

            // configure search box
            _srchMedia.View = view;
            foreach (string name in "Artist|Album|Name".Split('|'))
            {
                _srchMedia.FilterProperties.Add(typeof(Song).GetRuntimeProperty(name));
            }

            // show media library summary
            UpdateSongStatus();
            view.VectorChanged += (s, e) => { UpdateSongStatus(); };

            // done loading songs, hide progress indicator
            _progressBar.Visibility = Visibility.Collapsed;
        }
Exemplo n.º 2
0
        // load songs into the grid
        async void BindGrid()
        {
            // load songs
            _songs = new ObservableCollection <Song>(await MediaLibraryStorage.Load());

            // configure grid
            var fg = _flex;

            fg.CellFactory = new MusicCellFactory();
            fg.Columns["Duration"].ValueConverter = new FlexGridSamples.MediaLibrary.SongDurationConverter();
            fg.Columns["Size"].ValueConverter     = new FlexGridSamples.MediaLibrary.SongSizeConverter();
            fg.ItemsSource = _songs;

            // done loading songs, hide progress indicator
            _progressBar.Visibility = Visibility.Collapsed;
        }