Click here to Skip to main content
15,885,365 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I want when user clicked on datagrid row then show popup under row
how can i do this?
Posted
Comments
ridoy 16-Dec-12 7:09am    
http://stackoverflow.com/questions/7751903/wpf-show-popup-on-datagrid-cell-mouseover
ARIA 5 16-Dec-12 7:18am    
Yes
I've already reviewed this address,
but this method does not work because tooltip is not permanent.
thanks
chester_it21 16-Dec-12 15:38pm    
hi, see my solution

1 solution

You can use
SelectedCellsChanged
in XAML into Control DataGrid

to be this :
SelectedCellsChanged="DataGrid1SelectedCellsChanged"


and in Code Behind :

C#
private void DataGrid1SelectedCellsChanged(object sender, System.Windows.Controls.SelectedCellsChangedEventArgs e)
        {
            try
            {
                var dataView = dataGrid1.CurrentCell.Item as DataRowView;
                if (dataView == null)
                {
// some code her if not have value selected
                }
                else
                {
                    var dataRow1 = dataView.Row[0].ToString();
                    var dataRow2 = dataView.Row[1].ToString();
                    var dataRow3 = dataView.Row[2].ToString();
// it depends on the number of row
		    MessageBox.Show("You have selected :" + dataRow1 +"," + dataRow2 +"," + dataRow3 );

                }
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.ToString());
            }
        }
 
Share this answer
 
Comments
ARIA 5 17-Dec-12 3:42am    
Thanks chester_it21
your solution dose not work,
i think after click on specific row we must cast datgridRow to specific class
however thanks for your help,
but i want show popup under specific row,so how to show popup at position of mouse pointer.
chester_it21 17-Dec-12 21:42pm    
hi ARIA, what you want to show in Popup...??
datarow from datagrid..??
ARIA 5 18-Dec-12 3:41am    
hi Chester thanks,
i have one popup that contains some tools.
chester_it21 17-Dec-12 21:46pm    
or see this for reference :
http://www.c-sharpcorner.com/uploadfile/mahakgupta/popup-control-in-wpf/
and
http://www.codeproject.com/Articles/27021/A-WPF-based-irregular-pop-up-window-demo
ARIA 5 18-Dec-12 4:19am    
thank u very much.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900