I've followed the instructions here - https://ko.infragistics.com/help/wpf/xampivotgrid-editingdatacells - to add a validator for edits to my xamPivotGrid. The screenshot shows a tootlip appearing on the invalid data.
However, I don't get a tootlip. The validation fires and the cell is outlined in red. If I add a validation summary control to the page the validation error is correctly shown in that so the validator is being called and is firing correctly.
I tried copying the style template for the xamPivotGrid but I couldn't see any tootlip definitions in it all.
How do I get the tooltip to appear?
Hello Kevin,
I have put together a sample project that uses a converter to get the ErrorContent for the ToolTip rather than directly indexing the Validation.Errors collection. This prevents the System.Windows.Data Error. I am attaching the sample project here.
Please let me know if you have any other questions or concerns on this matter.
XamPivotGridValidationTooltipDemo.zip
Thanks for the answer.
I've implemented it, but unfortunately the tooltop is still not appearing. I'm getting this error in Visual Studio's output window:
> System.Windows.Data Error: 17 : Cannot get 'Item[]' value (type 'ValidationError') from '(Validation.Errors)' (type 'ReadOnlyObservableCollection`1'). BindingExpression:Path=(0)[0].ErrorContent; DataItem='PivotEditControl' (Name=''); target element is 'PivotEditControl' (Name=''); target property is 'ToolTip' (type 'Object') ArgumentOutOfRangeException:'System.ArgumentOutOfRangeException: Specified argument was out of the range of valid values.
> Parameter name: index'
I think this means that the errors collection is empty but if I set a break point in the CellEditing event handler that does the validation I can see that the errors collection has one entry,
I have been investigating into the behavior you are reporting, and it appears that the screenshot shown in the documentation may be a duplicate to the Silverlight XamPivotGrid back when we supported Silverlight. The Silverlight XamPivotGrid had some differences to the WPF one, and as far as I can see, the WPF one never had a red tooltip like this.
Still, I have put together some tests on my end, and I have figured out a way to get a tooltip into the cell when an error is present using the code in the documentation article. The code for this is below:
<Style x:Key="editorStyle" TargetType="{x:Type ig:PivotEditControl}"> <Style.Triggers> <DataTrigger Binding="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.HasError)}" Value="True"> <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}"/> </DataTrigger> </Style.Triggers> </Style>
If you take this Style and apply it to the EditorStyle property on the XamPivotGrid, this should allow you to show the content of your validation error in a ToolTip.