observablecollection

How to Copy List in Observable Collection in Thread

元气小坏坏 提交于 2019-12-12 04:07:48
问题 I have a background worker who fills/refills a List and After refilling and editing the List I copy this list in an Observable List: this.OBSMailCountList = new ObservableCollection<IMailCount>(_allMailCounts); The Problem is that the Collection is bind to an Live Diagramm and after the Copy in the List I get the Error : "The Value can not be NULL". My Question is: How to Copy an Observable Collection with Bindings in a Thread ? 回答1: Your problem is that you have _allMailCounts == null at the

Why is InvalideOperationException thrown when I try to serialize to XML an ObservableCollection containing hierarchical elements?

心不动则不痛 提交于 2019-12-12 04:07:11
问题 I write WPF MVVM modular application using Prism 6 in MS VS 2015 Professional. When I try to serialize to XML file the hierarchical ObservableCollection using System.Xml.Serialization.XmlSerializer then System.InvalidOperationException is thrown in System.Xml.dll. Below is definition of the collection: public class Group : ProfileElementType { . . . . . . private ObservableCollection<ProfileElementType> _childProfileElenents; [Browsable(false)] public ObservableCollection<ProfileElementType>

How to databing datagrid with class with collection and modify columns accordingly

你。 提交于 2019-12-12 03:25:58
问题 I have the following class: public class MyDimension { public MyDimension() { obcItemsName = new ObservableCollection<string>(); obcItemsMeasured = new ObservableCollection<double>(); } public string NameAxisDimension { get; set; } public double Nominal { get; set; } public double UpperTolerance { get; set; } public double LowerTolerance { get; set; } public ObservableCollection<string> obcItemsName; public ObservableCollection<double> obcItemsMeasured; } and its instances are stored into:

Update ObservableCollecttion on objects property changed

你。 提交于 2019-12-12 02:36:19
问题 Hopefully someone can help me out with this. I am creating a Silverlight app which is used for editing images. A user has a project which contain layers which contain elements. (Elements are text and image elements). I have a class which represents the project. It contains an ObservableCollection and each Layer has an ObservableCollection. Element is an abstract class. There is a TextElement and ImageElement class which inherit from Element. My problem is the UI never gets updated when I

Async Update ItemsControl Inside of a Datagrid (or suggest a better way)

孤街浪徒 提交于 2019-12-12 01:52:53
问题 I have a datagrid bound to an observable collection. Each item inside of the grid can have multiple detail lines, which are stored in an observable collection property inside of the main object. The line details are being fetched from a linked server with a slow connection, so I'd like to put a background worker in to update the line details OC, but I get an error saying that the control can't be updated outside of the thread that made it. What's the best way to do this. The 2 second lag is a

Initialize Collection of DataTemplates in XAML

拥有回忆 提交于 2019-12-12 01:48:10
问题 I have this DependencyProperty public ObservableCollection<DataTemplate> WizardTemplateCollection { get { return (ObservableCollection<DataTemplate>)GetValue(WizardTemplateCollectionProperty); } set { SetValue(WizardTemplateCollectionProperty, value); } } // Using a DependencyProperty as the backing store for MyProperty. This enables animation, styling, binding, etc... public static readonly DependencyProperty WizardTemplateCollectionProperty = DependencyProperty.Register(

Xaml two way binding of textbox to observable collection

匆匆过客 提交于 2019-12-11 22:13:39
问题 In my WP8 app I have a class, which has a ObservableCollection<ObservableCollection<int>> property called Matrix. I want to display these matrices using items control. <ItemsControl ItemsSource="{Binding FirstMatrix.Matrix}"> <ItemsControl.ItemTemplate> <DataTemplate> <ItemsControl ItemsSource="{Binding}"> <ItemsControl.ItemsPanel> <ItemsPanelTemplate> <StackPanel Orientation="Horizontal"></StackPanel> </ItemsPanelTemplate> </ItemsControl.ItemsPanel> <ItemsControl.ItemTemplate> <DataTemplate>

Implementing INotifyPropertyChanged with ObservableCollection

♀尐吖头ヾ 提交于 2019-12-11 21:37:15
问题 I want to pull data from a database to display into a ComboBox, and then allow users to select values from that ComboBox and add them into a ListBox (via add/remove buttons). Would I be able to get away with using an ObservableCollections to hold the database values to bind to the ComboBox, since it implements INotifyPropertyChanged (and CollectionChanged )? Sorry if this is a basic question, I starting learning WPF about a month ago. I've read over the article (very well done) by Sacha

Data Grid not updating from ViewModel

痞子三分冷 提交于 2019-12-11 21:28:36
问题 Do you know why looking at the code in the XAML and ViewModel why a Data Grid wont update when the an item is added? I know the DataGrid binding is correct as will add an item if I add it by code, however I am adding a item via a view. Also the getter of the ObservableCollection is getting hit every time I do add a item. Thanks ------ Code ------ XAML <Window x:Class="Importer.MainWindow" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com

Attaching ObservableCollection as ItemsSource of ItemsControl

℡╲_俬逩灬. 提交于 2019-12-11 20:09:05
问题 I have an object like so: class RCLocation : INotifyPropertyChanged { private string _id; private string _name; private bool _checked; public string Id { /* get/set with NotifyPropertyChanged() */ } public string Name { /* get/set with NotifyPropertyChanged() */ } public bool Checked { /* get/set with NotifyPropertyChanged() */ } /* INotifyPropertyChanged implementation methods */ } Now in my MainWindow.xaml I have an ItemsControl like so: <ItemsControl Name="lstDropOff" ScrollViewer