observablecollection

Getting a WPF Listview to display ObservableCollection<T> using databinding

瘦欲@ 提交于 2020-01-14 08:19:11
问题 I have a observable collection of type Project, that I want to be displayed in a ListView but nothing is added to my ListView which I really dont understand My MainWindow.xaml <ListView Name="ListViewProjects" Grid.Column="0" Grid.RowSpan="3" SelectionChanged="ListViewProjectsSelectionChanged" ItemsSource="{Binding}" IsSynchronizedWithCurrentItem="True" MinWidth="100"> <ListView.ItemTemplate> <DataTemplate> <WrapPanel> <TextBlock Text="{Binding Path=ProjectID}"/> <TextBlock Text="{Binding

When using ObservableCollection<T>, do I still need to implement INotifyPropertyChanged on type T?

做~自己de王妃 提交于 2020-01-12 15:48:14
问题 The MSDN reference page for ObservableCollection<T> notes: "The objects in your collection must satisfy the requirements described in the Binding Sources Overview. In particular, if you are using OneWay or TwoWay (for example, you want your UI to update when the source properties change dynamically), you must implement a suitable property changed notification mechanism such as the INotifyPropertyChanged interface." Since ObservableCollection<T> already implements INotifyPropertyChanged , why

When using ObservableCollection<T>, do I still need to implement INotifyPropertyChanged on type T?

家住魔仙堡 提交于 2020-01-12 15:48:10
问题 The MSDN reference page for ObservableCollection<T> notes: "The objects in your collection must satisfy the requirements described in the Binding Sources Overview. In particular, if you are using OneWay or TwoWay (for example, you want your UI to update when the source properties change dynamically), you must implement a suitable property changed notification mechanism such as the INotifyPropertyChanged interface." Since ObservableCollection<T> already implements INotifyPropertyChanged , why

Accessing items in ObservableCollection bound to WPF DataGrid

帅比萌擦擦* 提交于 2020-01-07 09:35:07
问题 I have an ObservableCollection bound to a WPF DataGrid in which MyClass has a Boolean flag indicating if item has been seen or not. If the item in the DataGrid is selected I want to set the MyClass.Seen property to true to indicate that it was viewed. Initially, the SelectedIndex of the DataGrid matches to the index of the ObservableCollection but if I ever sort the DataGrid using any of the various columns that it displays, the SelectedIndex no longer matches with the ObservableCollection.

Cannot resolve property 'myObservableCollection' in data context of type ''namespace.class"

隐身守侯 提交于 2020-01-07 05:06:24
问题 I have a class called Stockage which inherit of INotifyPropertyChanged. this class set some strings and then create an ObservableCollection of ObservableCollections. This ObservableCollection send values to the several strings set before. Like this: public class Stockage:INotifyPropertyChanged { public string Flag { get; set; } public string GroupeAlerte { get; set; } public string Pmid { get; set; } public string LibellePmrq { get; set; } public string Ligne { get; set; } public string Otm {

Binding WPF DataGrid ItemsSource creates memory leak

ぃ、小莉子 提交于 2020-01-07 04:25:09
问题 I'm simply creating a Observable collection in Background and binding to it. All objects inherit from INotifyPropertyChanged. but nevertheless the Memory consumption is continuously raising. The following Objects instances are continuously raising WeakReference FrugalObjectList<WeakEventManager+Listener> ConditionalWeakTable<TKey, TValue>+Entry<Object, Object>[] WeakEventTable+EventKey ConditionalWeakTable<Object, Object> SingleItemList<WeakEventManager+Listener> Object Int32[]

How to programmatically form an observable collection and bind it to a datagrid

一个人想着一个人 提交于 2020-01-07 03:40:53
问题 I have a problem which i'd divide in two steps: Problem1. Form an observable collection of strings and bind it to a datagrid ObservableCollection<string[]> octest = new ObservableCollection<string[]>(); var el = new string[6] {"1","2","3", "4", "5", "6" }; octest.Add(el); octest.Add(el); octest.Add(el); dtgResults.ItemsSource = octest; the problem is that the binding results in the image below: Problem 2 The same but now with an array of strings but with mixed elements (e.g. 3 strings and 3

Updating ObservableCollection does not properly update ListView in Xamarin Forms

亡梦爱人 提交于 2020-01-06 08:17:06
问题 I have a ListView in XAML that is bound to an ObservableCollection in the ViewModel. Upon initialization or OnAppearing() the ListView items are displayed perfectly. However, when I try to update the ListView items from within the page (through ViewModel) the items are updated but the old items are still there. Basically, the new items are added to the ListView but below the items that were in the ObservableCollection before. I have implemented INotifyPropertyChanged and I think I have done

Checkbox event that fires AFTER the value has changed

ぐ巨炮叔叔 提交于 2020-01-06 02:26:11
问题 I'm creating my very first wpf application. At this moment I need an event that fires AFTER the value of a checkbox has changed, so checked and unchecked are out of the picture :-( I have a datagrid, binded to an observable collection. In this datagrid I have a column with checkboxes (binded to a property in the observ. col.). A textbox on the form shows the 'total value' that is the sum of the values of all checked items. So when a checkbox is checked/unchecked I need to recalculate the

Listview to display ObservableSelection

蹲街弑〆低调 提交于 2020-01-05 05:55:33
问题 I have Student table, Course table and a StudentCourse table. On my WPF, I'm making "Student" selections with combo box. How can I display the corresponding Course and its properties(CourseID, CourseName, Credit) in a listview, using ObservableCollection?. Here's my code for the combo box SelectionChanged event private void comboBox1_SelectionChanged(object sender, SelectionChangedEventArgs e) { int MySelect = (int)this.comboBox1.SelectedValue; var SelectedStudent = db.Students.Include(