How to suppress error message when user inserts incorrect formula in cell? Or override OnFormulaValidate procedure in cell.
I need something like "={SomeSQLProcepure(param1, para2)} + A1 + SUM(B1:B3)"
Do i have ability to override validate procedure logic by my logic? And show my message on my language?
Thanks.
I'm not sure what solution you found but for the benefit of others that might find this post I'll add a little more info to the thread. When you are exiting edit mode the xamSpreadsheet evaluates the text entered similar to how Excel does to see if its a formula, number formatted in one of the various expected formats (e.g. date, time, scientific, fraction, etc) or just text in which case if there is inconsistent formatting a FormattedString may be created. Text that starts with an = is treated as a formula and we will try to create our Excel Formula based on the text entered. In this case the text entered is not a valid Excel formula (you'll get an error if you try entering the given string in Excel too) and so we display a message to the end user similar to how Excel would. If you want to suppress the display of the message you can handle the UserPromptDisplaying event. The Trigger property of the event args is an enumeration that indicates the type of action that triggered the prompt. In this case that would be FormulaParseError. If you want to suppress the message box you can set the DisplayMessage property of the event args to false. Or if you want to change the message/caption then you can set the Message/Caption properties respectively. Note in this case the value though is still an error and so the end user will be kept in edit mode (if possible) so they can correct the error. If you want to enter this as plain text then you might precede the text entered with a '.
Thank you for the feedback Igor. I am glad that the issue is resolved. Please do not hesitate to contact us if you have any questions.
I found solution for me. Thank you.
i must set DataValidationRule for each cell? How do you imagine that? But thank you, it's at least something.
Hello Igor,
Thank you for posting!Each cell in xamSpreadsheet can have DataValidationRule set. DataValidation rule is an abstract class that provides functionality to modify the message title and description, as well as its visibility. There is also a CustomDataValidationRule that can be used if a custom rule needs to be applied. Details on this functionality and code snippets can be found at http://help.infragistics.com/doc/WPF/2015.2/CLR4.0/?page=xamComboEditor_Using_CustomValueEnteredAction.html