observablecollection

Sort ObservableCollection bound to DataGrid in MVVM

混江龙づ霸主 提交于 2019-12-12 14:14:57
问题 I have a DataGrid that I'm binding to an ObservableCollection in my view model and I need to be able to sort the collection when the DataGrid is sorted to so I can use this sorted order elsewhere. I'm currently using a wrapper on the ObvservableCollection to support sorting. When the DataGrid is sorted it only sorts the displayed data and not the underlying data in the collection. The data consists of one integer column and one string column and needs to support ascending and descending sort

Remove from Observable collection in ViewModel does not update View, but Updates of Existing Items does update View

China☆狼群 提交于 2019-12-12 12:15:45
问题 I'm sure this will be a slam dunk for someone... fingers crossed My ListView ItemsSource is bound to a Property on my ViewModel named TileItems. Populating the list view updates perfectly. In the ViewModel, where you see "existingTileItem.Transaction = e.Transaction" . . . The individual listview item updates perfectly. In the ViewModel, where you see "Me.TileItems.Remove(existingTileItem)" ... The item is not removed from the View. It does successfully remove from the Me.TileItems collection

How do you do proper binding and updating of Xamarin.Forms ListView?

…衆ロ難τιáo~ 提交于 2019-12-12 08:48:16
问题 Using the MVVM pattern, I have a Model, ViewModel and View, which contains a ListView. The ListView is bound to a member of the ViewModel that is an ObservableCollection of the Model class. I can get the binding for the initial display to work and can update properties on the Model class for the appropriate row upon acting on the view, but I cannot get the view to refresh, pulling data from the Model class in the ObservableCollection. The ListView class does not contain method to invalidate

IQueryable<a> to ObservableCollection<a> where a = anonymous type

∥☆過路亽.° 提交于 2019-12-12 08:35:05
问题 I want the datacontext of my listview to be binded to an observable collection. Right now I have: // CurrentEmploye = some employee Entities.DatabaseModel m = new Entities.DatabaseModel(); var q = from t in m.TimeSheet join emp in m.Employees on t.idEmployee equals emp.id where emp.id == CurrentEmploye.id select new { firstName = emp.firstName, lastName = emp.lastName, position = emp.position, clockInDate = t.clockInDate, clockOutDate = t.clockOutDate, }; listView1.DataContext = q; that code

Binding multiple ObservableCollections to One ObservableCollection

♀尐吖头ヾ 提交于 2019-12-12 07:35:16
问题 Have a bunch of ObservableCollection<MeClass> Result and require to combine them all into another ObservableCollection<MeClass> AllResults so I can display it in a listview . Just not sure how to combine them all in one. I Created a new class to combine them all but not sure how they will get updated after I got the list once... So not really sure which direction to take. I know about INotifyPropertyChanged I'm just not sure how to combine them all and keep updating as everything changes. 回答1

How to sort ListView With ObservableCollection by Clicking Header

半腔热情 提交于 2019-12-12 06:15:23
问题 I am beginner at WPF. I am trying to sort (asc/desc) a listview by clicking a column. I have binded an observable collection to my listview. I have tried something I have found here https://msdn.microsoft.com/en-us/library/ms745786(v=vs.110).aspx For some reason it doesn't work on me. My code is almost same within this link here. But I wrote it here anyways though sorry that it's a little bit long. I made some search and many answer already suggests exactly what I did. So I guess I made some

Virtualizing/Paging Data in ObservableCollection bound to ItemsControl in WinRT

邮差的信 提交于 2019-12-12 06:13:00
问题 How can we Visualize data in an ObservableCollection or List which is set as ItemSource of ItemsControl? We are using ItemsControl within a ScrollViewer to make a custom collections control, due to some technical reasons(Design Constraints), we can not use ListView, or GridView controls which supports VirtualizingStackPanel and Data Virtualization through ISupportIncremental, so we must use ItemsControl within a ScrollViewer. So how can our ScrollViewer control notify the bound observable

Best/cleanest strategy to update an ObservableCollection from another thread

醉酒当歌 提交于 2019-12-12 05:56:31
问题 Normally I check if I have access to the ObservableCollection and if not, I call a Dispatcher . Here (on Stackoverflow ) are also some other solutions, but I don't know what is the best and cleanest way. I think my solution is obsolete and should not be used anymore. In my example is the ItemsCollection bound to the UI . The _UpdateTheCollectionFromAnotherThread() would being called (from another thread or would open another thread ) and save the data temporary to items . After that I would

ObservableCollection not updating

我的未来我决定 提交于 2019-12-12 04:40:13
问题 I feel like i'm really close to getting this to work. I have a calender, I want the user to be able to pick a month from a combobox and show the calender for that date. Right now nothing is being displayed no matter what I choose from the combobox. I can get it to work by using a listbox and a button event but its not really updating its just clearing and displaying the new month choosen. It's not the right way to do it. I've put a lot of time into this and if anybody can look at and maybe

Creating Word file from ObservableCollection with C#

萝らか妹 提交于 2019-12-12 04:17:55
问题 I have an observable collection with a class that has 2 string properties: Word and Translation. I want to create a word file in format: word = translation word = translation word = translation word = translation... The word document needs to be in 2 Columns (PageLayout) and the Word should be in bold. I have first tried Microsoft.Office.Interop.Word. PageSetup.TextColumns.SetCount(2) sets the PageLayout. As for the text itself I used a foreach loop and in each iteration I did this: paragraph