Question
I have a DataGrid and would like to populate it with some test data, so I can see it in the designer while working on it. How do I do that?
What I already have
I've created two classes:
ProductList
using System.Collections.ObjectModel;
namespace Wpf.DataGrid
{
class ProductList
{
private ObservableCollectio...
I have a viewmodel that implements IDataError. In the viewmodel I have an ObservableCollection. The ObservableCollection populates a datagrid in my view:
// the list that populates the datagrid
public ObservableCollection<ProjectExpenseItemsDto> ListOfProjectExpenseItems
{
get { return listOfProjectExpenseItems; }
...
Guys,
I was wondering if there's any way i could handle when a collection changes and, after that, display a message to the user.
As im using MVVM, i dont have any references to the model inside the view project, so i couldn't do
MyCollection col = InstanceOfViewModel.Read();
Since View doesn't know anything about "MyCollection", a...
I'm not sure what to do as far as managing the _namePrefixes for this control. I know I can make it non-static, but it makes sense to be static to be consistent across all uses of this control in terms of content for my project. Also, I chose ObservableCollection because of the following scenario:
I have 2 client machines, one for stand...
I'm not sure how to go about this exactly. I have a static ObservableCollection in the NameField.cs class. I just have no idea how to bind it to the listbox.
Should I not be using a ListBox?
Should I be using a DependencyProperty?
Should I be exposing the ObservableCollection through a property or by public?
I'm not sure what to do h...
Hello all, I appologize for the novel but I wanted to explain as much as I have done thus far.
Within my current project I have an application that consumes a service that provides a collection as a <List>. Due to how I am using this data in the application I have had to convert this data to an observable collection. This was done so th...
OK I got a project that has a application layer, web layer and a data layer shared by the other two layers.
Now I have one part that is Hierarchical data that the application has to be able to look over, edit and add new to.
So at the top is Company wich can have many Divisions and each division has Employees & Production Licenses (tw...
Hi folks,
in my Silverlight 4 Application I have an ObservableCollection that I data bind to two different listboxes. The listboxitems showing the content of the MyClass-Object. When I add an item to the ObservableCollection, the new item is displayed in both listboxes properly.
I have set the Binding Mode to two way, so that editing t...
I have a repository:
public ObservableCollection<ProjectExpenseBO> GetProjectExpenses()
{
//Get by query
IQueryable<ProjectExpenseBO> projectExpenseQuery =
from p in _service.project_expense
from e in _service.vw_employee
where p.employee_id == e.employee_id
select new ProjectExpenseBO()
{
...
I have a render-heavy item template in an ItemsControl and want to minimize the recreation of child item templates when ItemsSource signals a change. I am wondering if, because ObservableCollection can tell WPF precisely what has changed (as opposed to just the whole list), if it is more efficient in rendering changes to the collection, ...
Hi,
I am trying to pull the data from an Excel File that has been saved as XML and bind it to a Silverlight DataGrid. I am following a tutorial that I found on the web, but I cannot get the desired results.
using System;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Documents;
using System.Windows.Ink;
using...
Hello,
I want to update collection after it was changed but I can't seem to get "away" from this exception:
Cannot change ObservableCollection during a CollectionChanged or PropertyChanged event.
Inside event handler I unsubscribe from Collection changed event before changing anything to prevent infinite loops and after changes are ma...
Hi!
In my WPF application I'd like to use LINQ as much as possible (expecially to avoid the "for each"). But WPF works a lot with the ObservableCollection, and I can't use LINQ with these kind of collection. How can I do?
Thanks,
Pileggi
...
Hi,
I wanna create a WPF treeview with data with two grouping options (radio buttons). So the data will be grouped in two different ways (2 level hierarchy), the lowest level being the actual data items, and the groups being just a way to represent the data for easier understanding. They would also be able to select items by group (chec...
How can I do that?
thats a no go:
ObservableCollection obsCol = new ObservableCollection(myIEnumerable);
scenario:
var query = from c in customers
select new Customer()
{
Products = from p in products
where p.Id = c.Id
...
I'm trying to make a ListBox that updates to the contents of an ObservableCollection whenever anything in that collection changes, so this is the code I've written for that:
xaml:
<ListBox x:Name="UserListTest" Height="300" Width="200" ItemsSource="listOfUsers">
<ListBox.ItemTemplate>
<DataTemplate>
<TextBlock T...
please note that I am trying to use NotifyCollectionChangedAction.Add action instead of .Reset. the latter does work, but it is not very efficient with large collections.
so i subclassed ObservableCollection:
public class SuspendableObservableCollection<T> : ObservableCollection<T>
for some reason, this code:
private List<T> _cache...
Hi,
I have a listbox which has a datatemplate applied to the items. Each item id to display 3 text fields. The listbox is bound to an observablecollection. Everything is working fine, but when i try to load more than ~100 items into the collection, it starts chewing up all my CPU and takes ages to load.
Any suggestions?
...
I am trying to iterate through a ObservableCollection grouping, but I cannot figure out the correct syntax for the foreach loop. Any thoughts?
ObservableCollection<SaleItem> list = new ObservableCollection<SaleItem>();
list.Add(new SaleItem("Beverage", "Pepsi", 3.99M));
list.Add(new SaleItem("Beverage", "Cok...
Hi
Trying to understand this binding process of the WPF.
See the code at the bottom.
In my "viewmodel", see the code at the bottom, i have an observable collection that is populating the listview with the items. Thats the one that contains a path called symbol to set the selected index in the combobox. Now my problem is that i need to...