observablecollection

Binding different real time updated ObservableCollection to same userControl template

I have a UserControl with template property on, and a listView where i want to bind my collections. I use them for a multiple window interface. How can i bind on several different windows (child template), different collection which are updated in real time. My example is for a sniffer with multiple interfaces packet capturing. Thank u ...

Read only observable collection

I have my class that has an internal observable collection. I want to pass the data in this to a user of the class via a function. I don't want them to be able to change the objects inside of the observable collection or the collection itself. What is the best way to do this performance and ease of use wise? ...

MVVM/WPF: Using a ObservableCollection<T> as a list in a domain model, is that good/bad ?

I have aggregated models like Customer:Order:Product. As my View is bound to the BillingViewModel which has a Property Customers of type ObservableCollection and ONE customer in this collection has a "list" of orders named ObservableCollection and ONE order in this collection has a "list" of products named ObservableCollection Well ...

How to bind to observable collection in code-behind from xaml

Hi how can i bind to this observablecollection (Mainpage.xaml.cs) public ObservableCollection tabs = new ObservableCollection(); in xaml? I've tried (Mainpage.xaml) But without any luck ...

Please critique this method

Hi I've been looking around the net for some tab button close functionality, but all those solutions had some complicated eventhandler, and i wanted to try and keep it simple, but I might have broken good code ethics doing so, so please review this method and tell me what is wrong. public void AddCloseItem(string header, object conte...

Use example of Scala ObservableSet Trait

Could anyone help me telling me how to use scala's ObservableSet trait? Thank you very much in advance ...

How to track deleted self-tracking entities in ObservableCollection without memory leaks

In our multi-tier business application we have ObservableCollections of Self-Tracking Entities that are returned from service calls. The idea is we want to be able to get entities, add, update and remove them from the collection client side, and then send these changes to the server side, where they will be persisted to the database. S...

Tabitem.focus only focuses on tabitem header

Hey. I have a tabcontrol that is bound to an observable collection. I've tried doing var tabitem = (TabItem)this.SingleOrDefault(ti => ti.Name == tabname); tabitem.Focus(); ((UserControl)tabitem.Content).Focus(); And it does seem like it focuses on the tabitem, but only on a btn in the header of the tabitem, not on the conte...

Why isn't it possible to update an ObservableCollection from a different thread?

In a multi-threaded WPF application, it is not possible to update an ObservableCollection from a thread other than WPF window thread. I know there are workarounds, so my question is not how to avoid the "This type of CollectionView does not support changes to its SourceCollection from a thread different from the Dispatcher thread" excep...

Dynamic menu items in WPF

Is there a way to create a section on a menu for a list of menu items to be populated by something like an ObservableCollection? I'd like to replicate the Window functionality in Visual Studio, where the open document tabs are listed in a numbered list, limited to the first 10. ...

Getting dates from observablecollection

Hi, I have a ObservableCollection bound to a Dockpanel. This collection holds some data, and one of the members is a datetime field. Now, i have created a calendar-control which requires a ObservableCollection of DateTime. Is it possible to get/make an ObservableCollection from the dockpanel? Let me show some xaml to make it a bit mor...

What is the best ViewModel Collection for WCF RIA Services?

Hi, I'm currently creating an registration application that will register records into different entities in my database. The whole solution is built in SL4, MVVM, Entity Framework and using WCF RIA Services. I have a heap of different views and viewmodels, all containing different types of input controls and bound controls (textboxes, ...

ObservableCollection and CollectionChanged Event

Why does the collectionchanged event not fire in the following code, yet I can see the new instance of InventoryBTO I add to the ObservableCollection? private ObservableCollection<InventoryBTO> _inventoryRecords; public ObservableCollection<InventoryBTO> InventoryRecords { get { return _inventoryRecords; } set ...

WPF: Binding to ObservableCollection in ControlTemplate is not updated

I created a ControlTemplate for my custom control MyControl. MyControl derives from System.Windows.Controls.Control and defines the following property public ObservableCollection<MyControl> Children{ get; protected set; }. To display the nested child controls I am using an ItemsControl (StackPanel) which is surrounded by a GroupBox. If...

WPF ObservableCollection in xaml

Hi, I have created an ObservableCollection in the code behind of a user control. It is created when the window loads: private void UserControl_Loaded(object sender, RoutedEventArgs e) { Entities db = new Entities(); ObservableCollection<Image> _imageCollection = new ObservableCollection<Image>(); ...

WPF and ADO.NET EF - not working

Hi, I'm writing a piece of code that takes the records from a sql ce 3.5 database, creates images based on the url provided and then fill the observablecollection with those Images. It looks like this: private void UserControl_Loaded(object sender, RoutedEventArgs e) { Entities db = new Entities(); ObservableCollection<Image> _...

wpf observableCollection

I have an ObservableCollection which is dataContext for my treeview when I try to remove an Item from ObservableCollection I will get an error that Object reference not set to an instance of an object . can you please tell me why this error is happening and what is the solution thanks EDIT 1: The code is something like : class MyClass...

How to display two ObservableCollections as a single list in WPF?

I have two ObservableCollections, say ObservableCollection<Cat> and ObservableCollections<Dog>. Cat and Dog both derive from class Pet. I want to display a list of all Pets. How do I do this? I prefer not want create a new ObservableCollection<Pet> by adding items from the two source lists because this list will become stale as more Cats...

ObservableCollection slicing using lambda

I have ObservableCollection<ViewUnit> _myItems field, where ViewUnit implements INotifyPropertyChanged. ViewUnit has Handled : bool property. The main view of WPF application has a ListBox which binds to _myItems. I want a separate view of non-handled items only, that is, to have an IObservableCollection<> depended on existing _myItem...

Datagrid not updated when item property for filter changes

I have a simple form with datagrid and a button. Items in the datagrid are bound to ObservableCollection of customers. The customer implements INotifyPropertyChanged interface. Each customer has a deleted property (type bool). I set a filter for the customers default view to filter out deleted customers based on the deleted property. So ...