This is a migrated thread and some comments may be shown as answers.

Position of the "Add new item" button

3 Answers 217 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Chris
Top achievements
Rank 1
Chris asked on 07 Jul 2011, 02:34 PM
Hi,

With the RadGridView, is it possible to move the positon of the "Click here to add new item" button, to the bottom? (the button that appears when you set

ShowInsertRow

 

 

="True"

Thanks

Chris

 

3 Answers, 1 is accepted

Sort by
0
Vanya Pavlova
Telerik team
answered on 07 Jul 2011, 02:52 PM
Hello Chris,

 

You may take a look at the following forum thread "Show NewRow at Bottom".


All the best,
Vanya Pavlova
the Telerik team

Register for the Q2 2011 What's New Webinar Week. Mark your calendar for the week starting July 18th and book your seat for a walk through of all the exciting stuff we will ship with the new release!

0
Chris
Top achievements
Rank 1
answered on 07 Jul 2011, 04:25 PM
Excellent thank you that works.
0
Calvin
Top achievements
Rank 2
answered on 03 Mar 2012, 01:17 AM
I downloaded the project in the referenced Silverlight thread.

http://www.telerik.com/community/forums/silverlight/gridview/show-newrow-at-bottom.aspx 

And when I ran that project, the "Click here to add new item" row was indeed placed at the bottom of the grid (as expected).

But I would like this add-new-row-at-the-bottom behavior in a WPF application.  So I copied the Silverlight project's UserControl XAML to a new WPF project's Window XAML and set DataContext = "ABCDE".ToCharArray(); in the code-behind.

However, the "Click here to add new item" row does not appear.

Can you supply XAML that will work in a WPF app?

Thanks!

Follow up: The only reason I wish to display the add new item row at the bottom of grid is because after a new item is added via the grid to the bound collection, it then shows up on the bottom (if the grid is unsorted) as the last row.  So, when there are many rows, the newly added item is immediately placed out of sight.

I've tried addressing this issue with a couple of approaches and both techniques have drawbacks.  One approach is to move, in the grid's RowEditEnded event, the newly-created row's bound item to the start of its containing collection.  The drawback to this approach is that the grid tends to loose focus to some other focusable element on the form when bound item is moved to the start of it's containing collection.

Another approach is to add a TimeStamp column to the GridView's ItemsSource's bound collection and display that TimeStamp column in the grid and sort it descending.  When a newly minted record is created, because the grid is sorted appropriately, the row will show up at the top of the grid just under the "Click here to add new item" row.  The disadvantage with this approach is that the model and grid are cluttered with an extra property and column.  One advantage with this approach is that the user can sort other columns and later upon desiring to enter multiple rows, sort the TimeStamp column.

Ideally it would be really nice if there was an easy way to configure the GridView for continuous-record-entry mode.

So I thought maybe I'd try a third technique to avoid the drawbacks of the preceeding two approaches by moving the "Click here to add new item" to the bottom of the grid.

One last comment.  I agree with other posts on this forum that one naturally assumes when clicking on the "...add new item" row that the first (left-most) editable column will be selected.  This behavior can be achieved via PreviewKeyDown, etc.; but there should perhaps be a property that offers this behavior.  Just a thought...


---Subsequent folllow up---
Though I'm not a XAML-head, I managed to figure out how to get the add new row to display at the bottom.  But it looks funny because it's below the horizontal scroll bar...and the app in question has many columns.
Tags
GridView
Asked by
Chris
Top achievements
Rank 1
Answers by
Vanya Pavlova
Telerik team
Chris
Top achievements
Rank 1
Calvin
Top achievements
Rank 2
Share this question
or