Hello,
I have a XamRibbonGroup with a ButtonTool that binds to an ICommand in the ViewModel. This command would execute the DataPresenterExcelExporter.Export.
However this builtin method needs a reference to the XamDataGrid (DataPresenterBase)in order to export the data.
How can I reference the XamDataGrid using MVVM from the Command ?
Thank you
Hello Andrew,
The solution I originally implemented had some issues.
I'm trying to adapt your solution. However, I have one XamRibbonGroup with a ButtonTool that acts on many views.In another words the XamRibbonGroup and the XamDataGrid are not in the same view. The export function needs the reference to that XamDataGrid.
MVVM makes things more challenging sometimes. Any idea ?
Thank you for the reply. Another great solution :)
I ended up creating a behavior and attaching it to the XamDataGrid.
Hello User101,
Thank you for your update. I am glad you were able to figure out how to push the XamDataGrid to your Export command.
I imagine you are likely using an ElementName binding, but if not, I have also attached a sample project that I had created that demonstrates how this could be done.
Please let me know if you have any other questions or concerns on this matter.
Sincerely,AndrewAssociate Developer
I have figured that one out.