Hi,
In one column of our xamdatagrid, it's just for displaying text. If the string is empty, we need to change it as a button so that we can do something. Can we do this?
If yes, how could we do this?
If no, we can also change the text color to trigger mouse down event. How to handle this?
Thanks for help.
Hello,
Thank you for your post. I have been looking into your question and I can suggest the following approaches for implementing the appearance that you have described:
I have created a sample application for you, that shows how you can implement both of those approaches.
Please let me know if you need any further assistance on the matter.
Sincerely,
Krasimir
Developer Support Engineer
Infragistics
www.infragistics.com/support
There is one question. How to add click event handler for button click? We cannot add it in style.
Thank for your reply. I am very glad that my suggestion was helpful for you. I have been looking into your question and if you are using StyleSelector for applying a style for the CellValuePresenter, with setter for the Template property, you should be able to handle the Click event of the Button.
If you are using the second approach, that I have suggest (setting the Template of the CellValuePresenter in trigger), you will get an error when trying to handle the event of the Button in the trigger. This is expected behavior for the WPF controls in this scenario. In order to be able to handle the click of the button in this scenario, I can suggest using a Commnad, instead of the event. I have modified the sample application that I have sent with my previous reply, to show how you can use a command to handle this scenario.