How to know which row is clicked on in DataGrid?


from threads, know datagrid doesnot support mouseleftbuttondown event. think there should alternative way there. here code:

                 <data:datagrid x:name="datagrid1" height="auto" isreadonly="true" autogeneratecolumns="false" width="auto" headersvisibility="none" borderthickness="0"
                               mouseleftbuttondown="datagrid1_mouseleftbuttondown">                   
                    <data:datagrid.columns>

                        <data:datagridtextcolumn header="title" binding="{binding path=title}" isreadonly="true"/>

                        <data:datagridtextcolumn header="release date" binding="{binding path=release_date}" fontsize="10" isreadonly="true"/>

                    </data:datagrid.columns>

                </data:datagrid>

the grid generated dynamically. me on this? many thanks.

hi woaizheda,

currently, can not current row directly.   workaround, can add mouseenter visiable rows.  example,

        private void gridouvrage_loadingrow(object sender, datagridroweventargs e)
        {
            e.row.mouseenter += new mouseeventhandler(row_mouseenter);
          
        }

when selectionchanged fired, restore public variable.  kind of temporary workaround. better experience, we'd better wait future release.

best regards,

jonathan



Silverlight  >  Programming Silverlight with .NET – General



Comments

Popular posts from this blog

Reindexing

Users List

List of charts