observablecollection

INotifyPropertyChanged not working on ObservableCollection property

时光总嘲笑我的痴心妄想 提交于 2019-12-25 04:33:16
问题 I have a class called IssuesView which implements INotifyPropertyChanged . This class holds an ObservableCollection<Issue> and exposes it as a DependencyProperty called Issues for consumption by Bindings . It is defined as below - public class IssuesView : DependencyObject, INotifyPropertyChanged { public Issues Issues { get { return (Issues)GetValue(IssuesProperty); } set { SetValue(IssuesProperty, value); if (PropertyChanged != null) { PropertyChanged(this, new PropertyChangedEventArgs(

How to traverse the item in the collection in a List or Observable collection?

主宰稳场 提交于 2019-12-25 03:42:56
问题 I have a collection that is binded to my Listview. I have provided options to user to "move up" "move down" the selected item in the list view. I have binded the selected item of the listview to my viewmodel, hence I get the item in the collection on which user want to do the operation. I have attached "move up" "move down" commands in my viewmodel. I want what is the best way to move up and down in the collection in the collection which is reflected in the list view. For example If the

Using INotifyPropertyChanged to refresh a databound datagrid?

我们两清 提交于 2019-12-25 02:24:09
问题 I have created a databound datagrid in WPF: 'ActionResults', when I run the application it shows the contents of the database table. The I.T dept. are going to manually update the 'ActionResult' table in SQL server management studio. If any changes are made to the table, they will display in the datagrid only after I restart the application. I would like to add an 'Update' button which will re-fresh the datagrid, displaying any changes made to the table. I was previously trying to do a hack

Wrapped ObservableCollection<T> throwing `'EditItem' is not allowed for this view` when bound to a WPF DataGrid

三世轮回 提交于 2019-12-24 17:26:46
问题 I created a wrapper to extend an ObservableCollection<T> [Serializable] public abstract class ModelCollection<TModel> : ModelCollectionBase, IList<TModel>, INotifyCollectionChanged, INotifyPropertyChanged where TModel : ModelBase<TModel> { private ObservableCollection<TModel> wrappedCollection = new ObservableCollection<TModel>(); // wrapper implementation goes here } I thought it was working fine until I attempted to bind items from a list to a DataGrid. <DataGrid ItemsSource="{Binding

Convert DataTable to ObservableCollection (Without specific class) [duplicate]

假如想象 提交于 2019-12-24 15:25:22
问题 This question already has answers here : DataTable to observable collection (2 answers) Closed 5 years ago . I would like convert DataTable in ObservableCollection without having a specific class in my solution. (All others solution in stackoverflow.com is with specific class.) The reason is that the DataTable represent a Stored Procedure Result, and in the future I would like change the Stored Procedure result without any change in the application. I can't bind directly my DataBale because I

Convert DataTable to ObservableCollection (Without specific class) [duplicate]

时间秒杀一切 提交于 2019-12-24 15:17:16
问题 This question already has answers here : DataTable to observable collection (2 answers) Closed 5 years ago . I would like convert DataTable in ObservableCollection without having a specific class in my solution. (All others solution in stackoverflow.com is with specific class.) The reason is that the DataTable represent a Stored Procedure Result, and in the future I would like change the Stored Procedure result without any change in the application. I can't bind directly my DataBale because I

Create A WPF ObservableCollection From A SubSonic 2.2 Collection

梦想与她 提交于 2019-12-24 12:23:50
问题 If I have a DAL created by SubSonic 2.2, how do I convert the Collections created by it to WPF ObservableCollections in code (pref.VB.NET) to be consumed by WPF? 回答1: Sorry !VB: [Test] public void Exec_Testing() { ProductCollection products = DB.Select().From("Products") .Where("categoryID").IsEqualTo(5) .And("productid").IsGreaterThan(50) .ExecuteAsCollection<ProductCollection>(); Assert.IsTrue(products.Count == 77); ObservableCollection<Product> obsProducts = new ObservableCollection

How to bind an ObservableCollection to a TreeView in a hierarchical way?

匆匆过客 提交于 2019-12-24 07:01:18
问题 I know this may be a duplicate but no solution works for me. So I have a class Technik which has these properties: public class Technik { public bool checkedTe { get; set; } public int TechnikID { get; set; } public string anlagengruppe { get; set; } public string techniktyp { get; set; } public string anlage { get; set; } public string bemerkung { get; set; } } Now I have a DataTable with 216 rows and each row is getting into a Technik object that is added into my ObservableCollection

Best way for converting linq to entity query to strongly typed ObservableCollection

和自甴很熟 提交于 2019-12-24 05:42:29
问题 I am learning these days Entity Framework 5. I developing WPF application which based on MVVM and PRISM. In order to get property changed notifications I am using ObservableCollection for keep my data. I have problem when I use linq to entity projection and I am not sure what is the best solution for it. As you know, when you execute projection through linq to entity you get anonymous type that no one know out the scope of the method. I searched how to make this query strongly typed. I seen

Sliding effect when adding new items to a WPF ListBox

别等时光非礼了梦想. 提交于 2019-12-24 02:45:23
问题 I have a WPF ListBox control which displays items of an RSS feed. I occasionally check the source of the RSS feed for new items. Once I detect a new item I add it to the observable collection which immediately adds the new item to the ListBox display. Is there a way to 'slide in' the new item from the top, pushing down the existing items? How would I achieve such an effect? Can it be done with a ListBox, or do I need to resort to my own container, such as a StackPanel and animate for example