Bind a Combobox Selected Item with DataGrid Column - wpf

I am new in WPF. I have 2 controls Combo box and DataGrid. They are bind with DataSource1{ProperyX} and DataSource2{PropertyA, ProperyB, ProperyX}. I have a requirement that the Combo Box value should get selected whenever any row is getting selected in DataGrid (i.e if a row selected having the value of Column ProperyX is "JHON" then the same "JHON" should get selected in Combobox) with DataSource2 ProperyX column.

Related

Add a column header to the dropdown part of a listbox or combo box

I'm new to ShieldUI.
Is is possible to add a column header to the dropdown part of a listbox or combo box?
Thanks,
pt

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.

silverlight componentone combobox binding issue

I have to display combobox in silverlight componentone flexgrid. but when i am applying valueconvertor to that column it works and display combobox, but when i select any value from combobox and select same column from other row then it automatically select the same value which is selected in previous row.

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 SelectedItem and Scrolling

I have a WPF DataGrid. The DataGrid is bound to an IList. The list has many many items so the DataGrid MaxHeight is set to a predefined value and the DataGrid automatically displays a scroll bar. The selection mode and unit are set to "single full row".
The form has a button called "New" that adds an item to the list that the datagrid is bound to.After "New" is clicked, the new item should be the new selected item. I do this via : dataGrid.SelectedItem = newItem;
This works ..but not as well as I expect it to.
I also want the dataGrid to scroll down to the newly selected item .. Any idea on how to do this ?
Regards,
MadSEB
After you set the SelectedItem, make sure to call DataGrid.ScrollIntoView with the new item. This will make sure that the new item is visible on screen.

Resources