本文整理汇总了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;
}
示例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;
}
示例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);
}
}
示例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);
}
示例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
示例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;
}
示例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;
}
示例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();
});
});
}
示例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));
}
}));
}
示例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;
}
示例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);
}
示例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;
}
示例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");
}
示例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);
}
}
示例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;
}