当前位置: 首页>>代码示例>>C#>>正文


C# ObservableCollection.OrderBy方法代码示例

本文整理汇总了C#中ObservableCollection.OrderBy方法的典型用法代码示例。如果您正苦于以下问题:C# ObservableCollection.OrderBy方法的具体用法?C# ObservableCollection.OrderBy怎么用?C# ObservableCollection.OrderBy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在ObservableCollection的用法示例。


在下文中一共展示了ObservableCollection.OrderBy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SalesDashboardLeadsViewModel

        public SalesDashboardLeadsViewModel(Command pushTabbedLeadPageCommand, INavigation navigation = null)
            : base(navigation)
        {
            _PushTabbedLeadPageCommand = pushTabbedLeadPageCommand;

            _DataClient = DependencyService.Get<IDataClient>();

            Leads = new ObservableCollection<Account>();

            MessagingCenter.Subscribe<Account>(this, MessagingServiceConstants.SAVE_ACCOUNT, (account) =>
                {
                    var index = Leads.IndexOf(account);
                    if (index >= 0)
                    {
                        Leads[index] = account;
                    }
                    else
                    {
                        Leads.Add(account);
                    }
                    Leads = new ObservableCollection<Account>(Leads.OrderBy(l => l.Company));
                });

            IsInitialized = false;
        }
开发者ID:rrawla,项目名称:app-crm,代码行数:25,代码来源:SalesDashboardLeadsViewModel.cs

示例2: EditAuthorWindow

        public EditAuthorWindow(ref IObjectContainer db, Author author)
        {
            InitializeComponent();
            _db = db;
            _author = author;
            Title += _author.LastName;

            // fill form
            LastNameTxtBox.Text = _author.LastName;
            BirthDatepicker.SelectedDate = _author.BirthDate;

            var collection = new ObservableCollection<PublicationEditableGrid>();
            foreach (var item in _db.QueryByExample(new Publication()))
            {
                var itemPub = item as Publication;
                collection.Add(new PublicationEditableGrid()
                {
                    Title = itemPub.Title,
                    Year = itemPub.Year,
                    IsAuthor = _author.Publications.Contains(itemPub)
                });
            }
            publicationsGrid.ItemsSource = collection.OrderBy(x => x.Title);
            publicationsGrid.SelectedItem = null;
        }
开发者ID:jacekk,项目名称:db4o-library,代码行数:25,代码来源:EditAuthorWindow.xaml.cs

示例3: FizickoLiceServisnaKnjizicaDetaljno

        public FizickoLiceServisnaKnjizicaDetaljno(PonudaDetaljno ponudaDetaljno)
        {
            InitializeComponent();

            this.ponudaDetaljno = ponudaDetaljno;

            dBProksi = new DB.DBProksi(Konfiguracija.KonekcioniString);

            try
            {
                ObservableCollection<DB.Mesto> _mesta = new ObservableCollection<DB.Mesto>(dBProksi.DajSvaMesta().ToList());

                if (!_mesta.Count.Equals(0))
                {
                    _mesta.Insert(0, new DB.Mesto());
                }

                comboBoxMestoFL.ItemsSource = _mesta.OrderBy(m => m.Naziv);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
开发者ID:vodolijabg,项目名称:LS,代码行数:25,代码来源:FizickoLiceServisnaKnjizicaDetaljno.xaml.cs

示例4: LauncherWindow

 public LauncherWindow(ObservableCollection<UICommand> commands, IEventAggregator events)
     : this()
 {
     this.registeredCommands = commands;
     this.launcherCommands = CommandFinder.FilterCommands(commands.OrderBy(c => c.Name));
     this.events = events;
     InitializeDataContext(launcherCommands, events);
 }
开发者ID:troelsrichter,项目名称:ShellLight,代码行数:8,代码来源:LauncherWindow.xaml.cs

示例5: ReadContactList_Loaded

        private void ReadContactList_Loaded(object sender, RoutedEventArgs e)
        {
            ReadAllContactsList dbcontacts = new ReadAllContactsList();
            DB_ContactList = dbcontacts.GetAllContacts();//Vai buscar os contactos
            if (DB_ContactList.Count > 0)
            {

            }
            lista.ItemsSource = DB_ContactList.OrderBy(i => i.Model.C_nome).ToList();//
        }//ListAll
开发者ID:Philipedeveloper,项目名称:Xcontact,代码行数:10,代码来源:MainPage.xaml.cs

示例6: OnSetConfigurationEntries

        partial void OnSetConfigurationEntries(ref ObservableCollection<ConfigurationEntryViewModel> value)
        {
            var orderedSettings = new ObservableCollection<ConfigurationEntryViewModel>();
            foreach (var entry in value.OrderBy(t => t.OrderIndex))
            {
                orderedSettings.Add(entry);
            }
            value = orderedSettings;

            
        }
开发者ID:ArildF,项目名称:Smeedee,代码行数:11,代码来源:TaskInstanceConfigurationViewModel.cs

示例7: OnNavigatedTo

        /// <summary>
        /// Invoked when this page is about to be displayed in a Frame.
        /// </summary>
        /// <param name="e">Event data that describes how this page was reached.
        /// This parameter is typically used to configure the page.</param>
        protected async override void OnNavigatedTo(NavigationEventArgs e)
        {
            Note = await App.DataModel.get_Notes();

            // sort the ObservableCollection by date (the default property)
            noteSort = new ObservableCollection<Notes>(Note.OrderBy(note => note));
            noteSort = new ObservableCollection<Notes>(noteSort.Reverse());

            noteFilter = noteSort;

            this.DataContext = noteFilter;
        }
开发者ID:IagoAleksander,项目名称:Money-note,代码行数:17,代码来源:SeeHistory.xaml.cs

示例8: JobHistoryViewModel

        public JobHistoryViewModel(RunbookViewModel runbookViewModel)
        {
            _runbook = (RunbookModelProxy)runbookViewModel.Model;
            Owner = _runbook.Context.Service;

            Jobs = new ObservableCollection<JobModelProxy>();

            //AsyncExecution.Run(ThreadPriority.Normal, () =>
            Task.Run(() =>
            {
                IList<JobModelProxy> draftJobs = null;
                IList<JobModelProxy> publishedJobs = null;

                try
                {
                    if (_runbook.DraftRunbookVersionID.HasValue)
                        draftJobs = Owner.GetJobs(_runbook.DraftRunbookVersionID.Value);

                    if (_runbook.PublishedRunbookVersionID.HasValue)
                        publishedJobs = Owner.GetJobs(_runbook.PublishedRunbookVersionID.Value);
                }
                catch (ApplicationException ex)
                {
                    GlobalExceptionHandler.Show(ex);
                }

                Execute.OnUIThread(() =>
                {
                    if (draftJobs != null)
                    {
                        foreach (var job in draftJobs)
                        {
                            job.BoundRunbookViewModel = runbookViewModel;
                            job.RunbookType = RunbookType.Draft;
                            Jobs.Add(job);
                        }
                    }

                    if (publishedJobs != null)
                    {
                        foreach (var job in publishedJobs)
                        {
                            job.BoundRunbookViewModel = runbookViewModel;
                            job.RunbookType = RunbookType.Published;
                            Jobs.Add(job);
                        }
                    }

                    Jobs = Jobs.OrderBy(j => j.StartTime).ToObservableCollection();
                });
            });
        }
开发者ID:peterschen,项目名称:SMAStudio,代码行数:52,代码来源:JobHistoryViewModel.cs

示例9: AddNewTweets

 public void AddNewTweets(ObservableCollection<NGTweeterStatus> tweeterStatuses)
 {
     tweeterStatuses.Reverse();
     DispatcherHelper.CheckBeginInvokeOnUI(
         () => tweeterStatuses.OrderBy(ts => ts.CreatedDate).ToList().ForEach(
             t =>
             {
                 if (t.RetweetedStatus == null)
                     _tweeterStatusViewModels.Insert(0, new TweetViewModel(t));
                 else
                 {
                     _tweeterStatusViewModels.Insert(0, new RetweetViewModel(t));
                 }
             }));
 }
开发者ID:NileshGule,项目名称:NGTweet,代码行数:15,代码来源:TimeLineViewModelBase.cs

示例10: FizickoLiceDetaljno

        public FizickoLiceDetaljno(DB.FizickoLice fizickoLice)
        {
            InitializeComponent();

            try
            {
                dBProksi = new DB.DBProksi(Konfiguracija.KonekcioniString);

                ObservableCollection<DB.Mesto> _mesta = new ObservableCollection<DB.Mesto>(dBProksi.DajSvaMesta().ToList());

                if (!_mesta.Count.Equals(0))
                {
                    _mesta.Insert(0, new DB.Mesto());
                }

                comboBoxMesto.ItemsSource = _mesta.OrderBy(m => m.Naziv);

            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
            }

            gridFizickoLice.DataContext = fizickoLice;

            //stvarno ne znam sto nece da sam selektuje mesto pa moram ovako (vidi binding za SelectetItem)
            foreach (DB.Mesto item in comboBoxMesto.Items)
            {
                if (item.MestoID == ((DB.FizickoLice)gridFizickoLice.DataContext).MestoID)
                {
                    comboBoxMesto.SelectedItem = item;
                    break;
                }
            }

            buttonSacuvaj.Visibility = Visibility.Collapsed;
            buttonSacuvajINovi.Visibility = Visibility.Collapsed;
            buttonSacuvajIZatvori.Visibility = Visibility.Collapsed;
            buttonServisnaKnjizica.Visibility = Visibility.Collapsed;
            buttonPonuda.Visibility = Visibility.Collapsed;
            buttonRadniNalog.Visibility = Visibility.Collapsed;



        }
开发者ID:vodolijabg,项目名称:LS,代码行数:45,代码来源:FizickoLiceDetaljno.xaml.cs

示例11: ReloadData

		public new void ReloadData()
		{
			var exampleData = new ObservableCollection<SimpleItem>();

			var howMany = new Random().Next(100, 200);

			for (int i = 0; i < howMany; i++)
			{
				exampleData.Add(new SimpleItem() { Title = Guid.NewGuid().ToString("N").Substring(0, 8) });
			}

			var sorted = exampleData
				.OrderBy(item => item.Title)
				.GroupBy(item => item.Title[0].ToString())
				.Select(itemGroup => new Grouping<string, SimpleItem>(itemGroup.Key, itemGroup));

			Items = new ObservableCollection<object>(sorted);
		}
开发者ID:daniel-luberda,项目名称:DLToolkit.Forms.Controls,代码行数:18,代码来源:GroupingPageModel.cs

示例12: AddAuthorWindow

        public AddAuthorWindow(ref IObjectContainer db)
        {
            InitializeComponent();
            _db = db;

            var collection = new ObservableCollection<PublicationEditableGrid>();
            foreach (var item in _db.QueryByExample(new Publication()))
            {
                var itemPub = item as Publication;
                collection.Add(new PublicationEditableGrid()
                {
                    Title = itemPub.Title,
                    Year = itemPub.Year,
                    IsAuthor = false
                });
            }
            publicationsGrid.ItemsSource = collection.OrderBy(x => x.Title);
            publicationsGrid.SelectedItem = null;
        }
开发者ID:jacekk,项目名称:db4o-library,代码行数:19,代码来源:AddAuthorWindow.xaml.cs

示例13: WriteSpacesTextToSrtFile

        public static void WriteSpacesTextToSrtFile(string path, ObservableCollection<Space> spaces)
        {
            Log.Info("Writing descriptions text to srt file");
            var sortedList = spaces.OrderBy(x => x.StartInVideo).ToList();
            int srtNum = 1;
            using (var sw = new StreamWriter(path))
            {
                foreach (var space in sortedList)
                {
                    var output = String.Format("{0}{1}{2} --> {3}{1}{4}{1}{1}",
                        srtNum.ToString(CultureInfo.InvariantCulture), Environment.NewLine, TimeSpan.FromMilliseconds(space.StartInVideo).ToString("hh\\:mm\\:ss\\,fff"),
                        TimeSpan.FromMilliseconds(space.EndInVideo).ToString("hh\\:mm\\:ss\\,fff"), space.Text);

                    sw.Write(output);
                    srtNum++;
                }
            }
            Log.Info("Descriptions text srt file successfully created");
        }
开发者ID:vserrago,项目名称:LiveDescribe-Desktop,代码行数:19,代码来源:FileWriter.cs

示例14: Window_Loaded

        private void Window_Loaded(object sender, RoutedEventArgs e)
        {
            try
            {
                ObservableCollection<DB.Radnik> _radnici = new ObservableCollection<DB.Radnik>(dBProksi.DajSveRadnike().ToList());

                if (!_radnici.Count.Equals(0))
                {
                    _radnici.Insert(0, new DB.Radnik());
                }

                comboBoxRadnik.ItemsSource = _radnici.OrderBy(f => f.Nadimak);
                comboBoxRadnik.SelectedIndex = 0;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message, "Greška", MessageBoxButton.OK, MessageBoxImage.Error);
            }
        }
开发者ID:vodolijabg,项目名称:LS,代码行数:19,代码来源:RadniNalogPretraga.xaml.cs

示例15: EditPublicationWindow

        public EditPublicationWindow(ref IObjectContainer db, dynamic publication)
        {
            InitializeComponent();
            TypeCombo.ItemsSource = StaticData.publicationTypes;
            _db = db;
            _publication = publication;
            _isBook = _publication is Book;
            Title += _publication.Title;

            // fill form
            TitleTxtBox.Text = _publication.Title;
            PublisherTxtBox.Text = _publication.Publisher;
            YearTxtBox.Text = _publication.Year.ToString();
            if (_isBook)
            {
                TypeCombo.SelectedIndex = 1;
                PriceTxtBox.Text = _publication.Price.ToString();
                PageFromTxtBox.Text = String.Empty;
                PageToTxtBox.Text = String.Empty;
            } else {
                TypeCombo.SelectedIndex = 0;
                PriceTxtBox.Text = String.Empty;
                PageFromTxtBox.Text = _publication.PageFrom.ToString();
                PageToTxtBox.Text = _publication.PageTo.ToString();
            }
            TypeCombo.IsEnabled = false;
            toggleTxtBoxesVisibility();

            var collection = new ObservableCollection<AuthorEditableGrid>();
            foreach (var item in _db.QueryByExample(new Author()))
            {
                var itemAut = item as Author;
                collection.Add(new AuthorEditableGrid()
                {
                    LastName = itemAut.LastName,
                    BirthDate = itemAut.BirthDate.ToShortDateString(),
                    IsPublication = _publication.Authors.Contains(itemAut)
                });
            }
            authorsGrid.ItemsSource = collection.OrderBy(x => x.LastName);
            authorsGrid.SelectedItem = null;
        }
开发者ID:jacekk,项目名称:db4o-library,代码行数:42,代码来源:EditPublicationWindow.xaml.cs


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