The followings are my code:
Code for serialization:
using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
public class Serializer
{
public Serializer()
{
}
public void SerializeObject(string filename, ObjectToSerialize objectToSerialize)
{
Stream stream = File....
I have a class called Client, which is a subclass of Configurable.
I have an ObservableCollection<Client> which I need to view as an ObservableCollection<Configurable>. This will allow me to databind to the list from some general layout generation code. It must also allow me to clear the list, and to add items to the list. Of course...
Hello,
I've a ObserableCollection with Items in it, which implement the INotifyPropertyChanged Interface.
This is how I create it:
var myCollection = new ObservableCollection<MyViewModel>();
myCollection.CollectionChanged += OnCollectionChanged;
_
private void OnCollectionChanged(object sender, NotifyCollecti...
I currently have a combobox with bound to an ObservableCollection
<ComboBox ItemsSource="{Binding Past}" DisplayMemberPath="Date" IsSynchronizedWithCurrentItem="True"/>
Using, 'IsSynchronizedWithCurrentItem' it "synchronizes" with a set of labels that show the data below in a set of labels like:
<Label DataContext="{Binding ...
Is there a way to filter/sort an observable collection and still keep the notifications?
I have looked around and I found CollectionViewSource which filters and sorts the collection as I require but when the an items property in which the filter relies changes at the source collection it does not refresh the filter.
Basically i requi...
I have a WPF Dev Express DxGrid that is bound to an ObservableCollection in the following way.
Private _FamilyList As New ObservableCollection(Of FamilyRecord)
MyGrid.DataSource = _FamilyList
When a user starts to enter information in the grid, I need to be able to check whether they have missed some information making it Invalid.
So...
ObservableCollection implements both INotifyCollectionChanged and INotifyPropertyChanged.
I understand that additions,
deletions (+ clear), and replacement
of items are notifiable to consumers
through the collection's event
CollectionChanged, and that updates
in the existing items can be
monitored using the items' event
PropertyChanged...
Hi,
I am stucked at the part where I have to bind a collection to a dynamic usercontrol. Scenario is something like this.
I have a dynamic control, having a expander , datagrid, combobox and textbox, where combox and textbox are inside datagrid. There are already two collections with them. One is binded with combobox and another is bind...
Hi, any help with this would be great.
I have a model
public class Master
{
...
public Detail[] Details {get; set;}
}
I am populating my view model from a WCF service which returns my collection of Master objects. I have configured the service reference to return observablecollection so I can use it easily in my view model.
M...
In WPF app I have a ListView which is connected with ObservableCollection ShQuCollection through databinding:
<ListView Name="ShSelList" ItemsSource="{Binding Source={StaticResource myDataSource},Path=ShQuCollection}" SelectionChanged="ShSelList_SelectionChanged">
<ListView.View>
<GridView>
<GridViewColumn Header="Co...
I'm creating a WPF application using the MVVM design pattern, and I'm trying to create a Combobox that allows the user to edit the items in the drop-down list at runtime, similar to the way MS Access 2007 lets you do it. So I've created a UserControl that builds on top of a Combobox... when the drop-down is shown, there is a button belo...
I have a treeview which binds to lots of nested ObservableCollections. Each level of the treeview shows an aggregated sum of all the hours in child items. For example:
Department 1, 10hrs
├ Team 10, 5hrs
│ ├ Mark, 3hrs
│ └ Anthony, 2hrs
└ Team 11, 5hrs
├ Jason, 2hrs
├ Gary, 2hrs
└ Hadley, 1hrs
Department ...
Is there a way to get notified when CompositeCollection's current location changes?
I need to have the CompositeCollection monitored by a CollectionView, any ideas are welcommed.
...
In my model I need to be made aware when a particular collection is changed so I am subscribing to the CollectionChanged event of the ObservableCollection. This is working really well except that the operation is fairly resource expensive.
So when client code does:
foreach(Item i in longList)
{
model.ObservableCollection.Add(i);
}
...
According to MSDN there is an overload for the ObservableCollection constructor to which you can pass an IEnumerable. According to the very short MSDN page this will make a "Copy" of the Ienumerable.
How do I determine how this will behave? Will the "Copy" be totally independent of the original or will changes made to the Ienumerable (S...
dhopton's comment got me thinking. What are some situations where you wouldn't want to use an ObservableCollection?
...
Sorry - my question is almost identical to this one but since it didn't receive a viable answer, I am hoping that someone else has some fresh ideas.
I have a WPF TreeView that is bound to a hierarchy of a single type:
public class Entity
{
public string Title { get; set; }
public ObservableCollection<Entity> Children { get; set...
Hi,
I'm using the wpf toolkit datagrid to display an observable collection of AccountViewModels.
The thing is when I delete an account from the grid, I want it removed from the ObservableCollection - to give the user visual feedback, but i want the underlying list of Account models to remain the same, just with an 'IsDeleted' flag set ...
Do you think this Model-ViewModel implementation is correct?
Note that Stars (in the VM) is an ObservableCollection of VMs inside another one, and i feel like it decouples the VM from the M because when removing an element from Stars, i still have to delete it's model manually.
Any ideas on how to improve this without using OnCollectio...
I have an ObservableCollection, and I'd like to set the content of an IList to this one. Now I could just create a new instance of the collection..:
public ObservableCollection<Bar> obs = new ObservableCollection<Bar>();
public void Foo(IList<Bar> list)
{
obs = new ObservableCollection<Bar>(list);
}
But how can I actually take ...