當前位置: 首頁>>代碼示例>>C#>>正文


C# Data.CollectionViewSource類代碼示例

本文整理匯總了C#中System.Windows.Data.CollectionViewSource的典型用法代碼示例。如果您正苦於以下問題:C# CollectionViewSource類的具體用法?C# CollectionViewSource怎麽用?C# CollectionViewSource使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


CollectionViewSource類屬於System.Windows.Data命名空間,在下文中一共展示了CollectionViewSource類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的C#代碼示例。

示例1: ListPage

        // Constructor
        public ListPage()
        {
            InitializeComponent();

            // trace data
            TraceHelper.AddMessage("ListPage: constructor");

            // set some data context information
            ConnectedIconImage.DataContext = App.ViewModel;
            LayoutRoot.DataContext = App.ViewModel;
            SpeechProgressBar.DataContext = App.ViewModel;
            QuickAddPopup.DataContext = App.ViewModel;

            // set some data context information for the speech UI
            SpeechPopup_SpeakButton.DataContext = this;
            SpeechPopup_CancelButton.DataContext = this;
            SpeechLabel.DataContext = this;

            ImportListViewSource = new CollectionViewSource();
            ImportListViewSource.Filter += new FilterEventHandler(ImportList_Filter);

            SortViewSource = new CollectionViewSource();
            SortViewSource.Filter += new FilterEventHandler(Sort_Filter);

            // add some event handlers
            Loaded += new RoutedEventHandler(ListPage_Loaded);
            BackKeyPress += new EventHandler<CancelEventArgs>(ListPage_BackKeyPress);

            // trace data
            TraceHelper.AddMessage("Exiting ListPage constructor");
        }
開發者ID:ogazitt,項目名稱:zaplify,代碼行數:32,代碼來源:ListPage.xaml.cs

示例2: MyDayViewModel

        public MyDayViewModel(
            [Import] IEventAggregator aggregator,
            [Import] ITasksService tasksService,
            [Import] IProjectsService projectsService,
            [Import] ITeamService teamService,
            [Import] IBackgroundExecutor executor,
            [Import] IAuthorizationService authorizator)
            : base(aggregator, tasksService, projectsService, teamService, executor, authorizator)
        {
            aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, OnSignedMemberChanged);

            aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskAdded, t => { UpdateTasks(); });
            aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskAssigneeChanged, t => { UpdateTasks(); });
            aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskChanged, t => { UpdateTasks(); });

            aggregator.Subscribe<ICollection<ProjectInfo>>(ScrumFactoryEvent.RecentProjectChanged, prjs => {
                List<ProjectInfo> prjs2 = new List<ProjectInfo>(prjs);
                if (MemberEngagedProjects != null)
                    prjs2.RemoveAll(p => MemberEngagedProjects.Any(ep => ep.ProjectUId == p.ProjectUId));
                RecentProjects = prjs2.Take(8).ToList();
                OnPropertyChanged("RecentProjects");
            });

            OnLoadCommand = new DelegateCommand(OnLoad);
            RefreshCommand = new DelegateCommand(Load);
            ShowMemberDetailCommand = new DelegateCommand<MemberProfile>(ShowMemberDetail);
            CreateNewProjectCommand = new DelegateCommand(CreateNewProject);

            eventsViewSource = new System.Windows.Data.CollectionViewSource();
        }
開發者ID:klot-git,項目名稱:scrum-factory,代碼行數:30,代碼來源:MyDayViewModel.cs

示例3: EngagementWindow

 internal EngagementWindow(GwupeClientAppContext appContext, DispatchingCollection<ObservableCollection<Notification>, Notification> notificationList, Engagement engagement)
 {
     InitializeComponent();
     _appContext = appContext;
     Engagement = engagement;
     engagement.PropertyChanged += EngagementOnPropertyChanged;
     try
     {
         ((Components.Functions.RemoteDesktop.Function)Engagement.GetFunction("RemoteDesktop")).Server.ServerConnectionOpened += EngagementOnRDPConnectionAccepted;
         ((Components.Functions.RemoteDesktop.Function)Engagement.GetFunction("RemoteDesktop")).Server.ServerConnectionClosed += EngagementOnRDPConnectionClosed;
     }
     catch (Exception e)
     {
         Logger.Error("Failed to link into function RemoteDesktop : " + e.Message, e);
     }
     _notificationView = new CollectionViewSource { Source = notificationList };
     _notificationView.Filter += NotificationFilter;
     _notificationView.View.Refresh();
     notificationList.CollectionChanged += NotificationListOnCollectionChanged;
     //SetTunnelIndicator(Engagement.IncomingTunnel, IncomingTunnelIndicator);
     //SetTunnelIndicator(Engagement.OutgoingTunnel, OutgoingTunnelIndicator);
     ShowChat();
     _ewDataContext = new EngagementWindowDataContext(_appContext, engagement);
     DataContext = _ewDataContext;
 }
開發者ID:gwupe,項目名稱:Gwupe,代碼行數:25,代碼來源:EngagementWindow.xaml.cs

示例4: TicketOrdersViewModel

 public TicketOrdersViewModel(ITicketService ticketService)
 {
     _ticketService = ticketService;
     _orders = new ObservableCollection<OrderViewModel>();
     _itemsViewSource = new CollectionViewSource { Source = _orders };
     _itemsViewSource.GroupDescriptions.Add(new PropertyGroupDescription("GroupObject"));
 }
開發者ID:hperassi,項目名稱:SambaPOS-3,代碼行數:7,代碼來源:TicketOrdersViewModel.cs

示例5: VMStudent

        public VMStudent()
        {
            students3 = new CollectionViewSource();

            Student stu1 = new Student();
            Student stu2 = new Student();
            stu1.Name = "zhangsan";
            stu1.PhotoBitmapImage1 = "E:\\新建文件夾\\3.png";
            stu2.Name = "lisi";
            stu2.PhotoBitmapImage1 = "E:\\新建文件夾\\4.png";

            students1 = new ObservableCollection<Student>();
            students1.Add(stu1);
            students1.Add(stu2);

            Student stu3 = new Student();
            Student stu4 = new Student();
            stu3.Name = "wangwu";
            stu3.PhotoBitmapImage1 = "E:\\新建文件夾\\1.png";
            stu4.Name = "zhaoliu";
            stu4.PhotoBitmapImage1 = "E:\\新建文件夾\\2.png";

            students2 = new ObservableCollection<Student>();
            students2.Add(stu3);
            students2.Add(stu4);
            students3.Source = students2;
        }
開發者ID:JiNanCVT,項目名稱:Calligraphy,代碼行數:27,代碼來源:VMStudent.cs

示例6: MainViewModel

        public MainViewModel(IEventAggregator eventAggregator, ISignalRClient signalRClient, IAuthStore authStore,
            IProductsRepository productsRepository)
        {
            this.eventAggregator = eventAggregator;
            this.signalRClient = signalRClient;
            this.productsRepository = productsRepository;

            deleteRequest = new InteractionRequest<Confirmation>();
            CreateProductCommand = new DelegateCommand(CreateProduct);
            OpenProductCommand = new DelegateCommand<Product>(EditProduct);
            changePriceCommand = new DelegateCommand(ChangePrice, HasSelectedProducts);
            deleteCommand = new DelegateCommand(PromtDelete, HasSelectedProducts);

            cvs = new CollectionViewSource();
            items = new ObservableCollection<Product>();
            cvs.Source = items;
            cvs.SortDescriptions.Add(new SortDescription("Name", ListSortDirection.Ascending));
            cvs.SortDescriptions.Add(new SortDescription("Size", ListSortDirection.Ascending));

            var token = authStore.LoadToken();
            if (token != null)
            {
                IsEditor = token.IsEditor();
                IsAdmin = token.IsAdmin();
            }
        }
開發者ID:hva,項目名稱:warehouse.net,代碼行數:26,代碼來源:MainViewModel.cs

示例7: Ctor

        public void Ctor()
        {
            var vm = new CalendarDetailsViewModel();

            Assert.IsFalse(vm.CanScrollHorizontal);
            Assert.IsTrue(vm.CanScrollVertical);

            Assert.AreEqual(LanguageService.Translate("Cmd_CreateCalendar"), vm.ToolbarItemList.First().Caption);
            Assert.AreEqual(LanguageService.Translate("Cmd_RemoveCalendar"), vm.ToolbarItemList.Last().Caption);
            Assert.AreEqual(LanguageService.Translate("Cmd_Save"), vm.WindowCommandItemList.First().Caption);
            Assert.AreEqual(LanguageService.Translate("Cmd_Cancel"), vm.WindowCommandItemList.Last().Caption);

            var daysOfWeek = new ObservableCollection<DayOfWeek>(new[]
                                                                 {
                                                                     DayOfWeek.Sunday,
                                                                     DayOfWeek.Monday,
                                                                     DayOfWeek.Tuesday,
                                                                     DayOfWeek.Wednesday,
                                                                     DayOfWeek.Thursday,
                                                                     DayOfWeek.Friday,
                                                                     DayOfWeek.Saturday
                                                                 });

            CollectionAssert.AreEqual(daysOfWeek, vm.DaysOfWeek);

            var workingIntervals = new CollectionViewSource();
            workingIntervals.SortDescriptions.Add(new SortDescription("StartDate", ListSortDirection.Ascending));
            workingIntervals.SortDescriptions.Add(new SortDescription("FinishDate", ListSortDirection.Ascending));

            CollectionAssert.AreEqual(workingIntervals.SortDescriptions, vm.WorkingIntervals.SortDescriptions);
        }
開發者ID:mparsin,項目名稱:Elements,代碼行數:31,代碼來源:CalendarDetailsViewModelTests.cs

示例8: TextFilter

 public TextFilter()
 {
     InitializeComponent();
     FilterCollection = new List<ItemFilter>();
     col = (CollectionViewSource)FindResource("collection");
     FilterCollection.Add(new ItemFilter() {Name = "Выделить все...", IsCheked = true });
 }
開發者ID:versussun,項目名稱:git-ato-base_client,代碼行數:7,代碼來源:TextFilter.xaml.cs

示例9: Window_Loaded

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {

            try
            {
                //commandRepositoryViewSource.View.CurrentChanging += new System.ComponentModel.CurrentChangingEventHandler(View_CurrentChanging);

                this.Topmost = false;
                commandRepositoryViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("commandRepositoryViewSource")));
                // Load data by setting the CollectionViewSource.Source property:
                commandRepositoryViewSource.Source = RepositoryLibrary.Repositorys;
                commandRepositoryViewSource.View.CurrentChanged += new EventHandler(View_CurrentChanged);
                runCommandViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("runCommandViewSource")));
                // Load data by setting the CollectionViewSource.Source property:
                if (((CommandRepository)(((ListCollectionView)(commandRepositoryViewSource.View)).CurrentItem)) != null)
                    runCommandViewSource.Source = ((CommandRepository)(((ListCollectionView)(commandRepositoryViewSource.View)).CurrentItem)).Commands;

            }
            catch (Exception ex)
            {


                MyMessageBox b = new MyMessageBox();
                b.ShowMe(ex.Message, "Unhandled error");
                Application.Current.Shutdown();
            }


        }
開發者ID:generic-user,項目名稱:Quicky,代碼行數:29,代碼來源:CommandManager.xaml.cs

示例10: MainWindow

        public MainWindow()
        {
            InitializeComponent();

            _collectionItems = new List<CollectionItem>();
            _viewCollection = new CollectionViewSource();
            _viewCollection.Filter += ViewCollectionFilter;

            if (File.Exists(CollectionFileName))
            {
                _projectCollection = ProjectCollection.LoadFromFile(CollectionFileName);
                TbRootProjectDir.Text = _projectCollection.RootDir;
                ShowCollection();
                ShowTags();
            }
            else
            {
                TbRootProjectDir.Text = Properties.Settings.Default.RootPath;
                _projectCollection = new ProjectCollection();
            }
            _viewCollection.Source = _collectionItems;
            //_viewCollection.SortDescriptions.Add(new SortDescription("FullPath", ListSortDirection.Ascending));
            LvProjects.ItemsSource = _viewCollection.View;
            _folders = CreateTree();
            _viewFolders = new CollectionViewSource {Source = _folders };
            TvFolders.ItemsSource = _viewFolders.View;
        }
開發者ID:Reddds,項目名稱:ProjectExplorer,代碼行數:27,代碼來源:MainWindow.xaml.cs

示例11: TasksView

 public TasksView()
 {
     InitializeComponent();
       var taskCollection = Resources["tasksCollection"];
       if (taskCollection is CollectionViewSource) {
     taskCollectionViewSource = taskCollection as CollectionViewSource;
       }
       if (taskCollectionViewSource != null) {
     taskCollectionViewSource.Filter += (s, e) => {
       var task = e.Item as Task;
       if (task == null) {
     return;
       }
       try {
     if (task.Status != "Closed" || (task.Status == "Closed" && showClosedCheckbox.IsChecked == true)) {
       e.Accepted = true;
     } else {
       e.Accepted = false;
     }
       } catch (Exception ex) {
     e.Accepted = false;
       }
     };
       }
 }
開發者ID:sunilmunikar,項目名稱:TaskR,代碼行數:25,代碼來源:TasksView.xaml.cs

示例12: UserTasksSelectorViewModel

        public UserTasksSelectorViewModel(
            [Import]IBackgroundExecutor executor,
            [Import]IEventAggregator aggregator,
            [Import]ITasksService tasksService,
            [Import] IDialogService dialogs,
            [Import]IAuthorizationService authorizator)
        {
            this.executor = executor;
                this.aggregator = aggregator;
                this.tasksService = tasksService;
                this.dialogs = dialogs;

                this.authorizator = authorizator;

                tasksViewSource = new System.Windows.Data.CollectionViewSource();
                notMineTasksViewSource = new System.Windows.Data.CollectionViewSource();

                TrackingTaskInfo = null;

                aggregator.Subscribe<MemberProfile>(ScrumFactoryEvent.SignedMemberChanged, m => { OnPropertyChanged("SignedMemberUId"); });

                aggregator.Subscribe(ScrumFactoryEvent.ApplicationWhentForeground, () => { LoadTasks(true); });

                aggregator.Subscribe(ScrumFactoryEvent.ShowUserTasksSelector, Show);

                aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskAssigneeChanged, OnTaskChanged);
                aggregator.Subscribe<Task>(ScrumFactoryEvent.TaskChanged, OnTaskChanged);

                ShowTaskDetailCommand = new DelegateCommand<TaskViewModel>(ShowTaskDetail);

                TrackTaskCommand = new DelegateCommand<TaskViewModel>(TrackTask);

               timeKeeper.Tick += new EventHandler(timeKeeper_Tick);
        }
開發者ID:klot-git,項目名稱:scrum-factory,代碼行數:34,代碼來源:UserTasksSelectorViewModel.cs

示例13: SortHelper

 public SortHelper(CollectionViewSource source)
     : base(source)
 {
     // Default behavior
     date = true;
     descending = true;
 }
開發者ID:Klaudit,項目名稱:inbox2_desktop,代碼行數:7,代碼來源:SortHelper.cs

示例14: Window_Loaded

 private void Window_Loaded(object sender, RoutedEventArgs e)
 {
     figuurViewSource = ((CollectionViewSource)(this.FindResource("figuurViewSource")));
     FiguurManager manager = new FiguurManager();
     figuren = manager.GetFiguren();
     figuurViewSource.Source = figuren;
 }
開發者ID:kurtkreemers,項目名稱:AdoCursus,代碼行數:7,代碼來源:StripFiguren.xaml.cs

示例15: HomePage

		public HomePage()
		{
			InitializeComponent();

            _HistorySource = (CollectionViewSource)this.Resources["HistorySource"];
			ViewModel.InitCollectionViewSources(_HistorySource);
		}
開發者ID:chier01,項目名稱:WF.Player.WinPhone,代碼行數:7,代碼來源:HomePage.xaml.cs


注:本文中的System.Windows.Data.CollectionViewSource類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。