We are using xamdatagrid. We are facing bellow two issues,
1) How to get cell click event with active data record.
2) How to change text and border color for field chooser popup window.
Please find the attached file for more details
Hi Kunal,
I hope the information in my response was helpful. Please let me know if you had further questions
The preview events fire before the new cell or record is activated. Hence the ActiveRecord holds the last active record which initially would be null. In any case it wouldn't necessarily be the record associated with the current preview cell.
It looks like in your sample you are using the default cellClickAction, so you might want to use the CellActivated event where you can access the e.Cell.Record. At that point the ActiveRecord would be the active cell's record. (There is a comparable event, RowActivated where you can access the e.Record.)
The only issue would be that if you click on the same cell twice, the event wouldn't fire a second time. Of course the ActiveRecord would not have changed either. I'm not sure I understand the implications of multiple clicks on the same cell in your processing. Perhaps it would be helpful for the CellValuePresenter's MouseLeftButtonDown to fire although it also would fire before the CellActivated event.
Please let me know if this information is helpful.
Thanks for your reply,
We are using MVVM. In XamDataGrid we have ActiveRecord="{Binding Path=ActiveRecord, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged}"
when we added
<i:Interaction.Triggers> <i:EventTrigger EventName="CellActivated"> <i:InvokeCommandAction Command="{Binding GridCommand}" /> </i:EventTrigger>
we are able to get ActiveRecord.But this property fires only if cell is not activated But while using PreviewMouseLeftButtonDown event is not firing.
If I raise PreviewMouseLeftButtonDown event through code behind, yes its working fine. But ActiveRecord property is null.
So we need cell click as every time click on same cell need to get ActiveRecord property as well.
Hello Kunal,
Since the XamDataGrid doesn't have a cell click event you'll have to use the PreviewMouseLeftButtonDown event and manually check to see what the user clicked on in the grid. An example can be found here: http://ko.infragistics.com/community/forums/p/2784/16536.aspx#16536
Regarding the field chooser, you can change the title by using the SetCustomizedString method. http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/?page=GeneralConcepts_Customizing_Resource_Strings_for_WPF_Only_control.html
http://help.infragistics.com/doc/WPF/2013.2/CLR4.0/?page=Resource_Strings_DataPresenter_Resource_Strings.html
Changing the background/border color of the field chooser popup window is a different matter though. It's not actually a Popup but a Window. This means that the standard approach to changing a regular WPF window's title bar apply. http://stackoverflow.com/questions/1283006/changing-wpf-title-bar-background-color
Let me know if you have any questions.