Hi, I'm trying to bind to DataItemIndex inside CellValuePresenter's ControlTemplate that's inside XamDataGrid (complete project attached):
<ControlTemplate TargetType="igDP:CellValuePresenter"> <Button Content="{Binding DataItemIndex}" Click="Button_Click" /> </ControlTemplate>
Unfortunately, if I delete a row, none of subsequent rows update their button's content even though DataItemIndex value changed and is visible in Button_Click handler.
If I bind to "Index" then everything works correctly. Is this a bug ?
Hello,
Thank you for your post. I have been looking into and the sample you provided and I can say that this behavior is expected and occurs by design and the DataItemIndex doesn’t triggers the Binding due to performance optimizations of the XamDataGrid. The VisibleIndex Property works the same way, only the Index Property Triggers the Binding. If you have further questions regarding this feel free to ask.
Looking forward for your reply.
1. Would be great if such important piece of information was provided in documentation of these properties. Also consider marking them with [Bindable(false)].
2. How can I convert Index to DataItemIndex while called from PropertyChanged(Index) ? Can I assume DataItemIndex has correct value at this point ? To be more specific I'm thinking about simulating binding of DataItemIndex with multibinding to {Index, DataRecord} and using converter that returns value[1].DataItemIndex.
I have created a sample project for you with the functionality you want. Basically I added a dummy Boolean Property to the Window and used a MultiBinding, and I update the Dummy Property in the RecordsInViewChanged event, so the multibinding can be triggered and the Property to which the DataItemIndex is bound could be updated.
Hope this helps you.
Thanks, that will do. Shame it's so hackish :(
Maybe you could add a flag to RecordManager to conditionally enable PropertyChanged events from DataItemIndex if user needs it and doesn't care about performance impact ?
Hello Marcin,
After some research the ability to make the DataItemIndex ipdates the target to which it is bound has been determine as a new Product Idea. I have sent your Product Idea directly to our product management team. Our product team chooses new Product Ideas for development based on popular feedback from our customer base. Infragistics continues to monitor application development for all of our products, so as trends appear in requested ideas, we can plan accordingly.
We value your input, and our philosophy is to enhance our toolset based on customer feedback. If your idea is chosen for development, you will be notified at that time. Your reference number for this Product Idea is PI12030025
If you would like to follow up on your Product Idea at a later point, you may contact Developer Support management via email. Please include the reference number of your Product Idea in the subject and body of your email message. You can reach Developer Support management through the following email address: dsmanager@infragistics.com
Thank you for your request.