0 Replies - 7244 Views - Last Post: 22 July 2013 - 06:13 PM Rate Topic: -----

#1 solarissf   User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 36
  • Joined: 27-March 12

add new column to datagrid, based on contents of 1st col of grid,wpf

Posted 22 July 2013 - 06:13 PM

0down votefavorite

Good evening all,

Using WPF databinding MVVM, I am attempting to bind data to multiple graphs and datatables. So far, from an XML file I create an observable collection, and have databound the properties to a datagrid. Now I need to do some crazy filtering that I am not sure is possible???

So from the observable collection, I have made a CollectionViewSource.
_singleManagerTrades = new CollectionViewSource {Source = indivTradeCollection}.View

And I apply filters by doing _singleManagerTrades.Filter = ManagerFilter;

public bool ManagerFilter(object item)
if property1 == xxx and property2 == yyy
return true
//blah blah blah

All this works correctly... my datagrid on the UI is filtered accurately.

So I have 2 questions..
1.am I doing this multiple filtering correctly?
2.The main harder question... my datagrid has 3 columns currently.. what I want to do is add a fourth column... and based on the contents of the 1st column value on that particular row... populate this fourth column with a SUM of some values in that original collection. so for example.. say column 1 row 1 states GOLD. I want my new fourth column be basically be a SUMIF equal to GOLD of some other particular column in original observablecollection.

Is this possible? And if so can someone please point me in the correct direction? It would greatly be appreciated!!!


Is This A Good Question/Topic? 0
  • +

Page 1 of 1