Esempio n. 1
0
        private void SetCVSSource(ListViewModel vm)
        {
            CollectionViewSource cvs = Resources["RecentItems"] as CollectionViewSource;

            if (cvs != null && vm != null)
                cvs.Source = vm.Items;
        }
Esempio n. 2
0
        /// <summary>
        /// Initializes a new instance of the <see cref="RecentListView"/> class.
        /// </summary>
        /// <param name="vm">A view model.</param>
        public RecentListView(ListViewModel vm)
            : this()
        {
            this.DataContext = vm;

            SetCVSSource(vm);

            if (vm != null)
            {
                vm.PropertyChanged += (s, e) =>
                {
                    if (e.PropertyName == "Items")
                        SetCVSSource(vm);
                };
                vm.Items.CollectionChanged += (s, e) =>
                {
                    RefreshCVSSource();
                };
            }
        }
Esempio n. 3
0
 /// <summary>
 /// Initializes a new instance of the <see cref="AllListView"/> class.
 /// </summary>
 /// <param name="vm">A view model.</param>
 public AllListView(ListViewModel vm)
     : this()
 {
     this.DataContext = vm;
 }