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

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.

Related

Put a Button on first row of WPF DataGrid Columns

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

Two radgridviews - programmatically select row on 2nd based on selection on 1st

I have two radgridviews where a row selected on grid #1 by the user appears automatically in grid #2. The new row in grid #2 needs to be programmatically selected as there may be further processing for that new row and the row index is needed.
Both grids use a datatable for their items source.
It is possible that the user can select the same item twice from grid #1. So the selected row in grid #2 must be the most current selection from grid #1.
How do I programmatically select the new row in grid #2?
Thanks
Datagrid in wpf is a derive class of ItemsControl which has the SelectedIndex property which you can use to get the first index of selection in your grid after which you can set the second grid selectedIndex to the first's.
int selectedIndex=grid1.SelectedIndex ;
grid2.SelectedIndex =selectedIndex.

extjs- checkboxgrid check boxs unselecting on clicking different column in grid

I am using checkboxmodel grid in extjs for display values.
after selecting multiple row checkboxs, if i click different column all selected checkbox are unselecting. how to stop this.
https://fiddle.sencha.com/#fiddle/18bj
Use checkOnly: true on the selection model:
True if rows can only be selected by clicking on the checkbox column,
not by clicking on the row itself. Note that this only refers to
selection via the UI, programmatic selection will still occur
regardless.
https://fiddle.sencha.com/#fiddle/18bo

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.

Datagrid Row Selection On Button Click In WPF

I am having a Datagrid that gets populated with values from a DataTable. In my program i have four buttons: Goto First, Last, Next and Previous, as the name name indicates i have to select the rows based on the selection made using these buttons. Everything seems well if i use the below code to get the row (for example first row).
DataGridRow row =(DataGridRow)userControl.m_DataGrid.ItemContainerGenerator.ContainerFromIndex(0);
row.IsSelected = true;
But the code throws null value when there is more rows than the height of the Datagrid(When scrollbar comes into picture).
Please help me out of this issue. I think this is because of the view problem.
Due to virtualization the containers are only created when the object is in view, so you could first scroll the item into view using the respective method, wait for the creation of the container and then select it.
As this is rather messy i would suggest binding the IsSelected to a property on your item using a style for DataGridRow (set it as ItemContainerStyle). Then you can just set the property to true and scroll the item into view if need be.

Resources