*** MODERATOR : This should be in WPF GridView - not sure how to move this & don't want to post twice ****
So I found out from support that the the .Columns collection is not populated until the grid is
shown when bound dynamically. I'm not sure I agree with that functionality. I should have access to these collections right
after the data is bound. Anyway, I am trying to add an aggregate function after the data is bound. My ultimate goal is
to be able to go through my columns, and dynamically apply aggregate functions to the column based on the data type.
As stated below, this will always be dynamically bound, I do not want to define my grid columns via XAML pre-bind since this will
be changing based on the dynamic binding.
Any help would be greatly appreciated!
Thanks!
Daryl
// I have some code that fills the grid dynamically.
// This is SUPER important as I will be filling this over and over
// again via some other widget which will bind to different SQL queries when the
// user clicks the "other widget" - say a tree control full of different queries.
// I DO NOT want to PREDEFINE what my columns are going to be via XAML
// As a sample, lets say in the load event of the form I fill the grid
// with this SQL
DataTable dt = g.DB.SelectDataTable(
"select * from category"
);
MyWPFGridView.ItemsSource = dt;
// I am trying to create a "dynamic" aggregation function on the
// first column but
// I am not seeing it manifest itself in the grid...
// ALSO: I am seeing this event get called TWICE...why?
void
Form1_DataLoaded(
object
sender, EventArgs e)
{
Debug.WriteLine(
"Form1_DataLoaded :: Telerik WPFGrid Column Count: "
+ MyWPFGridView.Columns.Count);
CountFunction f =
new
CountFunction();
f.Caption =
"Count"
;
MyWPFGridView.Columns[0].AggregateFunctions.Add(f);
}