当前位置: 首页>>代码示例>>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;未经允许,请勿转载。