• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# Data.CollectionViewSource类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Windows.Data.CollectionViewSource的典型用法代码示例。如果您正苦于以下问题:C# CollectionViewSource类的具体用法?C# CollectionViewSource怎么用?C# CollectionViewSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



CollectionViewSource类属于System.Windows.Data命名空间,在下文中一共展示了CollectionViewSource类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的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


示例16: FilterOptionsViewModel

        /// <summary>
        /// Initializes a new instance of the <see cref="FilterOptionsViewModel"/> class.
        /// </summary>
        public FilterOptionsViewModel()
        {
            FilteredSystemVariables = new CollectionViewSource { Source = SystemVariables };
            FilteredSystemVariables.Filter += FilteredSystemVariablesOnFilter;

            this.defaultValueHolder = new DefaultValueHolder(this);
        }
开发者ID:mparsin,项目名称:Elements,代码行数:10,代码来源:FilterOptionsViewModel.cs


示例17: FauxDataSource

 public FauxDataSource()
 {
     _unitDataSource = new ObservableCollection<Unit>(); ;
     
     int jobid = 5000;
     
     //generate a few thousand Units, with 1 detail(job) each
     for (int i = 1; i <= 3000; i++)
     {
         Random r = new Random(DateTime.Now.Millisecond);
         Unit u = new Unit();
         u.Id = i;
         u.Name = "Unit " + i;
         u.Location = RandomString(10, false);
         u.UnitStatus = (Status) r.Next(1, 6);
         UnitJob j = new UnitJob();
         j.JobId = jobid--;
         j.JobDescription = RandomString(15, false);
         j.UnitId = i;
         j.JobDurationMinutes = r.Next(5, 20);
         u.Jobs = new ObservableCollection<UnitJob>();
         u.Jobs.Add(j);
         _unitDataSource.Add(u);
     }
     
     UnitViewSource = new CollectionViewSource();
     UnitViewSource.Source = _unitDataSource;
     UnitViewSource.IsLiveFilteringRequested = true;
     UnitViewSource.IsLiveSortingRequested = true;
     UnitViewSource.LiveFilteringProperties.Add("UnitStatus");
 }
开发者ID:codingbandit,项目名称:TriTechDemo,代码行数:31,代码来源:FauxDataSource.cs


示例18: FamilyData

        public FamilyData()
        {
            InitializeComponent();

            // Get the data that is bound to the list.
            CollectionViewSource source = new CollectionViewSource();
            source.Source = App.Family;
            FamilyEditor.ItemsSource = source.View;

            // When the family changes we'll update things in this view
            App.Family.ContentChanged += new EventHandler<Microsoft.FamilyShowLib.ContentChangedEventArgs>(OnFamilyContentChanged);

            // Setup the binding to the chart controls.
            ListCollectionView tagCloudView = CreateView("LastName", "LastName");
            tagCloudView.Filter = new Predicate<object>(TagCloudFilter);
            TagCloudControl.View = tagCloudView;

            ListCollectionView histogramView = CreateView("AgeGroup", "AgeGroup");
            histogramView.Filter = new Predicate<object>(HistogramFilter);
            AgeDistributionControl.View = histogramView;
            AgeDistributionControl.CategoryLabels.Add(AgeGroup.Youth, Properties.Resources.AgeGroupYouth);
            AgeDistributionControl.CategoryLabels.Add(AgeGroup.Adult, Properties.Resources.AgeGroupAdult);
            AgeDistributionControl.CategoryLabels.Add(AgeGroup.MiddleAge, Properties.Resources.AgeGroupMiddleAge);
            AgeDistributionControl.CategoryLabels.Add(AgeGroup.Senior, Properties.Resources.AgeGroupSenior);

            BirthdaysControl.PeopleCollection = App.Family;
        }
开发者ID:olcayseker,项目名称:PostSharp-Toolkits,代码行数:27,代码来源:FamilyData.xaml.cs


示例19: _Initialize

        private void _Initialize()
        {
            try
            {
                Records = new ObservableCollection<HistoryRecord>();
                RecordsViewSource = new CollectionViewSource();
                RecordsViewSource.Source = Records;


                HistoryRecord hr = new HistoryRecord();
                hr.Id = "123";
                hr.ItemFullPath = "c:\\file.txt";
                hr.Count = 1;
                hr.DeviceName = "user1";
                hr.ItemSize = 100;
                Records.Add(hr);

                hr = new HistoryRecord();
                hr.Id = "123";
                hr.ItemFullPath = "c:\\HAHA.txt";
                hr.Count = 2;
                hr.DeviceName = "user1";
                hr.ItemSize = 100;
                Records.Add(hr);

                

                
            }
            catch (Exception ex)
            {
                
            }
        }
开发者ID:huangxuanheng,项目名称:ChooseDishes,代码行数:34,代码来源:ListWindowViewModel.cs


示例20: ProductDropdownFilterViewModel

 public ProductDropdownFilterViewModel()
 {
     var list = this.GetProducts();
     this.filteredProducts = new CollectionViewSource();
     this.filteredProducts.Source = list;
     this.filteredProducts.Filter += this.ProductFilter;
 }
开发者ID:function1983,项目名称:GreenP,代码行数:7,代码来源:ProductDropdownFilterViewModel.cs



注:本文中的System.Windows.Data.CollectionViewSource类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# Data.DataTransferEventArgs类代码示例发布时间:2022-05-26
下一篇:
C# Data.BindingBase类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap