0

I have a class named Tasks.cs:

namespace Player_beta.ViewModels
{
    public class Tasks : ICollectionView
    {
        private ICollectionView _customerView;

        public ICollectionView Customers
        {
            get { return _customerView; }
        } 
    public ObservableCollection<PlaylistVM> PlayLists
    {
        get { return _playLists; }
        set { _playLists = value; }
    }
//etc

In my Window1.xaml I wrote:

xmlns:local="clr-namespace:Player_beta.ViewModels;assembly="

Then I've tried to create a local instance of Tasks.cs and get access to its PlayLists property, but failed:

    <Window.Resources>
            <local:Tasks x:Key="mtask"/>
            <CollectionViewSource Source="{StaticResource mtask.PlayLists}" x:Key="customerView">
                <CollectionViewSource.SortDescriptions>
                    <scm:SortDescription PropertyName="plNAME"/>
                </CollectionViewSource.SortDescriptions>
            </CollectionViewSource>
        </Window.Resources>
........................
 <ListBox DisplayMemberPath="plNAME" ItemsSource="{Binding Source={StaticResource customerView}}" />

I know that I can create an instance of Tasks.cs in Window1.xaml.cs and then bind it to Window1's DataContext, but its DataContext already bound to an instance of another class - PlayerVM.cs.

bart
  • 304
  • 1
  • 3
  • 13

1 Answers1

0

Not sure what you want to achieve by implementing ICollectionView on Task class.

But for you question you need to specify Path in your binding to bind to property PlayLists :

Source="{Binding Path=PlayLists, Source={StaticResource mtask}}"
Rohit Vats
  • 79,502
  • 12
  • 161
  • 185
  • I am using ICollectionView to sort list of playlists (ObservableCollection PlayLists). – bart Aug 06 '14 at 13:58