I just Add Footer and Current Row indicator !

Sep 29, 2008 at 9:58 PM

Hello

I tried to change code source of this Datagrid to add new useful functionality in business application.

It is very useful to have some Total,average, etc.. .... at the bottom of each Column ... like an "Header" at the top of each Column.

So, I added on each column, a Footer property, FooterStyle, FooterTemplate, FooterTemplateSelector, etc. ... and changed Generic.xaml to add DataGridFootersPresenter and friends ...

Moreover, I added a new dependancy property bool DataRowHeader.IsCurrentRow and change generic.xaml to show a small triangle in DataRowHeader to show the Current Row in DataGrid (use full when is combined with DataGrid.IsSynchronizedWithCurrentItem="true" )

example of code : 
        private static object OnCoerceIsCurrentRow(DependencyObject d, object baseValue)
        {
            DataGridRowHeader header = (DataGridRowHeader)d;
            DataGridRow parent = header.ParentRow;
            if (parent != null)
            {
                object currentItem = null;
                if (parent.DataGridOwner.CurrentCell != null)
                   currentItem = parent.DataGridOwner.CurrentCell.Item;
                if ((currentItem != null)  && (currentItem != DependencyProperty.UnsetValue))
                    return parent.Item == currentItem;
                else
                {
                    if (parent.DataGridOwner.SelectionMode == DataGridSelectionMode.Single)
                    {
                        object selectedItem = parent.DataGridOwner.SelectedItem;
                        return (selectedItem != null) && (parent.Item == selectedItem);
                    }
                }
            }
            return baseValue;
        }

The internal code is pretty good, I think, It is easy to understand, I like for example the internal notification system. this design pattern would be useful for other WPF controls :-)

my question : How can I submit these requests for changes the to WPFToolKit Team ?
(or the code source modification even if I am not understand all the subtility of the code, The Header approach has help me a lot ...)

Best regards

Thibaud


Another submit :
  • FixedColumn at the right side of the datagrid
  • +/- expander on Detail panel when the source is Grouping
Sep 30, 2008 at 12:11 AM
$0Is footer row planned for the final release?$0$0$0$0In case it is not, Thibaud, is it possible to have your code?$0$0
Coordinator
Sep 30, 2008 at 5:52 PM
Thibaud,

Thanks so much for your input.  I and other members of the WPF Toolkit team read this forum daily and record any feature requests in an internal database which we will use to consider new features for future releases.  Your requests for a footer row, fixed column on the right, and expander on the details when in grouping have been recorded.  While we won't be able to include this in our v1 release, we will consider them for later versions.

If you’d like to share your work to help other developers, it’d be great if you could post code snippets and “how to” instructions here in the Discussions (similar to what you did above) or post links to blog posts if you have a blog.  This would be very valuable to the WPF development community. 

If you have any other requests for features, please feel free to create new posts to let us know!

Thank you,
Samantha
Oct 14, 2008 at 8:41 PM
Hello Samantha
Just to be sure ... Can I post somewhere a zip file with all my changes in your code ? no problem with copyright or something like that ?
I am not sure I have enough time to realize an "how to" article in next few weeks and so, It would be more easy for me to just post a zip file with your code and just my changes ... :-)
It would be easy for a developper to do a diff between original sources and new version to see all the differences ... :-)
Best regards
Thibaud
Coordinator
Oct 15, 2008 at 12:01 AM
Hi Thibaud,

Yes, that shouldn't be a problem.  Under the Microsoft Public License (Ms-PL) which is associated with this site, you are granted "a non-exclusive, worldwide, royalty-free copyright license to reproduce its contribution, prepare derivative works of its contribution, and distribute its contribution or any derivative works that you create."  The only restriction is that "If you distribute any portion of the software in source code form, you may do so only under this license by including a complete copy of this license with your distribution."  You can find a copy of the license under the License tab: http://www.codeplex.com/wpf/license - just stick a .txt file with a copy of the license in your zip file and you should be good to go!

Thanks!
Samantha
Oct 15, 2008 at 10:40 AM
Hi Thibaud,
I'd really like to see your changes.is there any way you can post it so I can use it without waiting for the v2 of DataGrid?
Oct 16, 2008 at 6:38 PM
Hello

I just had a message in my blog here : http://thibaud60.blogspot.com/2008/10/wpftoolkit-datagrid-with-footer-and.html
You can find the zip source file in a link
Regards
Thibaud
Nov 1, 2008 at 4:59 PM
Hello

With the version of Datagrid (announces in 2008 PDC) : I just update my version with Footer 

Moreover, I update too the CurrentRow indicator (just with a new template, no modification in source code, great ! (with new RowHeaderTemplate property)

You can downloaded this new version here : http://thibaud60.blogspot.com/2008/11/new-version-of-datagrid-with-footer.html

Dear Samantha ! I woud be great you can integrate this type of functionnality in the next version !! :-)

I just look difference between Beta version and this new version ! your team works hard ! thanks a lot for this future official datagrid of WPF 4.0

Regards

Thibaud

Sep 8, 2009 at 3:08 PM

I would like an update on the column footer status.

When is the next version of the grid coming out and will the footer be included in it?

Thanks and continue the great work.

Jun 2, 2010 at 2:06 PM

Thank you Thibaud.

I would like to have footer in Datagrid to show aggregate values like sum\ avergage\ count, etc.,  Got any newer version ot release on this?

Thanks in advance

Nov 9, 2010 at 11:26 PM
Edited Jan 6, 2011 at 12:49 AM

Not to be a conspiracy theorist, but I believe this is going nowhere because of Microsoft's many control suite partners that make money off of basic things like a "Footer" for data grids. How many years has it been now that people are asking for this? (of course, I don't expect MS to do our job for us, so...)

Looks like I'll be using Thibaud's update for v4: http://thibaud60.blogspot.com/2010/02/footer-on-wpf-datagrid-by-use-several.html

Thank you Thibaud.

UPDATE 2011-01-05: Thibaud's solution works wonderfully for syncronizing grids!

Apr 8, 2011 at 2:02 AM

Is this a joke?  Does the WPF DataGrid really not have a footer row in April of 2011?!?!  How much are third-party widget vendors paying you guys to leave this out?!?!?! 

May 23, 2012 at 4:35 PM


I've been looking at the datagrid footer project and thinks it's realy useful. However, I've noticed a bug when you drag a header over two columns the associated grid column moves to the correct place but the main grid column stays in it's original position, do you have any ideas how to fix this ?

May 23, 2012 at 9:17 PM

Hello

In my prototype application, I can easely reproduce the bug. The bug is different if I change the binding Mode of Index column Binding (see AssociatedDataGrid.SynchronizeVerticalDataGrid method)

If you change to OneWay Mode, Datagrids work differently ... With TwoWay, grid A change index property of column C, Column C of the Grid B change, and Column A, and B change of Grid B change, with Binding,  column A, B and C of Grid A change too ... It is a little bit complex to manage this algorithm ....

This code is a prototype, just a prove of concept
For real application, I think it would be better to don't use Binding to synchonize index of columns, for Width property, I think is OK, but for index property, kinematics of change's properties is difficult to control with Binding ... It would better to use the "old school" algorithm ... (override metaproperty of Index column property, and use DependencyChangedProperty event to synchonize himself grid A and Grid B OR use Attached property to intercept cyclique change of Index property Values)

I hope it can help you to adapt this code for your needed

Best regards

 

Oct 18, 2012 at 4:36 PM

Hi;

 

You mention that there is a version for .Net 4. The download does not look to be the same as the previous. You mention that the new version has synch capabilities between grids but I don't see the footer capability that was in the previous version. Did I miss something - or is the previous version the actual DataGrid with footer.

 

Peter

Oct 19, 2012 at 10:59 PM

Hello Peter

I am not sure to understand your question, but if you want create a footer with this technic : http://thibaud60.blogspot.com/2010/02/footer-on-wpf-datagrid-by-use-several.html

you must insert in your xaml, Two instances of datagrid, and synchronize each one with another

In bottom DataGrid, you need hide header's columns and put the bottom datagrid just under the first with Zero pixel between each one !