Put a Button on first row of WPF DataGrid Columns - wpf

I'm working on the WPF application.
My application has a DataGrid with 4 columns which works properly.
I only want the first row to have a Button with DataGrid width for inserting new data by user's click.
First row's columns may be use Column span.
Also I read How to add button in first row of datagrid column? .
This solution Insert Button to All Rows and control with Collapsing .
Thanks in advance for any help

Related

Adding rows and columns dynamically to table control

I need to create UI using winforms which is similar to the diagram. The table needs
row one - one label and 20 buttons
row two - combox box, box and 20 buttons
row three - combox box, box and 20 buttons
row four - combox box, box and 20 buttons
In the column zero of the row zero, i need to add label and from next column need to add buttons
In the column zero of the row one,need combobox and button and then from column1 again buttons.
How to do add combox box and button to the same column(column zero) using the tablecontrolpanel, the width of the column zero should be not changed.
I am using table control to add the 20 buttons, but don't know how to add the button and combox box to the same column.

On Click on the RowHeader the current row should be editable and On click of the columnHearder current column of all row should be editable

I have a silverlight DataGrid, by default on page load the all the cells of the datagrid should be Readonly. I have 2 problem , can any one help me?
1.On Click on the RowHeader the current row should be editable
2. On click of the columnHearder current column of all row should be editable
This might not solve your entire problem but it should partially address it.
This is to make a column read-only in a datagrid
DataGrid.Columns[7].IsReadOnly = true;
Obviously the property can be changed from events but the data grid does not have row/column headers event handlers. Custom controls seem the way to go without introducing any new gui elements like buttons and changing the feel of the application.

WPF : Know which Control is clicked on Datagrid

I have a DataGrid bounded to OservableCollection populated cols and rows dynamically. The DataGrid's row has couple of buttons. On each button a method is called (have implemented AddHandler while generating columns).
In the handler method, I can get which row was selected. I want to know the button of which column was selected. Based on that only I can take action and open respective windows.
How do I know which button of the row was selected ?
I get the column using :
int col = myDataGrid.CurrentCell.Column.DisplayIndex;
int row = seivesTorGrid.SelectedIndex;
Based on this I am able to code respective actions.

How to select a row, if i click a disabled cell in a wpf datagrid

I have a wpf dynamic datagrid with a column disabled. if i click a cell in that column, the row is not selected.
The following article shows how to detect the row and column of a DataGrid click:
http://www.scottlogic.co.uk/blog/colin/2008/12/wpf-datagrid-detecting-clicked-cell-and-row/
This will work for disabled columns also.
You can adapt this code so that when the row is found, you set its IsSelected property to true.

WPF DataGrid: edit all cells, new row position, click once to edit

I was wondering if anyone could point me into the right direction with DataGrids.
I'm trying to position the new row at the top of the grid
When the user clicks a cell all cells in the row move into an editable state.
Cheers
Check this out for single click editing:
http://wpf.codeplex.com/wikipage?title=Single-Click%20Editing
And this for New row formatting:
http://blogs.msdn.com/b/vinsibal/archive/2008/11/05/wpf-datagrid-new-item-template-sample.aspx
I think positioning a new row on top might not be possible as the new item row is not part of the DataGrid's control template. Haven't given it a try though.

Resources