Your Privacy Matters: We use our own and third-party cookies to improve your experience on our website. By continuing to use the website we understand that you accept their use. Cookie Policy
985
Xamgrid- Showing tooltip with the errorcontent using idataerrorinfo
posted

Hi,

I need to show the validation error on the tooltip of the xamgrid when User is entering invalid data from new row control.

I am using IDataErrorInfo for the same, error is getting displayed to the user with a red border on the cell but no information about the error is getting displayed.

I tried a lot but my trigger is not working.

Can someone please suggest me with a sample of how to work this out.

Below is what i tried to get it displayed but it didn't worked.

<ig:TextColumn.EditorStyle>  <Style TargetType="{x:Type TextBox}">   

 <Style.Triggers>    <Trigger Property="Validation.HasError" Value="true">   

  <Setter Property="ToolTip" Value="{Binding RelativeSource={RelativeSource Self}, Path=(Validation.Errors)[0].ErrorContent}" />    </Trigger>   </Style.Triggers>  </Style>                     

  </ig:TextColumn.EditorStyle> 

 

Please help.

Thanks

Rakesh

Parents
No Data
Reply
  • 30945
    Offline posted

    Hello Rakesh,

     

    Thank you for your post. I have been looking into the functionality that you are trying to achieve and I can suggest binding to the indexer property of the IDataErrorInfo, in the EditorStyle of the TextColumns. Here is how you can implement the binding:

     

                    <ig:TextColumn Key="Name">

                        <ig:TextColumn.EditorStyle>

                            <Style TargetType="TextBox">

                                <Setter Property="ToolTip" Value="{Binding Path=.[Name]}"/>

                            </Style>

                        </ig:TextColumn.EditorStyle>

                    </ig:TextColumn>

     

    Also, in order to be able to notify that the indexer property is changed you can use the following approach in the view model:

     

        public class ViewModelVase : INotifyPropertyChanged, IDataErrorInfo

        {

     

            [IndexerName("Item")]

            public string this[string columnName]

            {

                get

                {

                    return (!errors.ContainsKey(columnName) ? null :

                          String.Join(Environment.NewLine, errors[columnName]));

                }

            }

     

                                    …….

            }

     

    I have created a sample application for you, that shows how you can implement this approach.

     

    Please let me know if you need any further assistance on the matter.

     

    Sincerely,

    Krasimir

    Developer Support Engineer

    Infragistics

    www.infragistics.com/support

    IDataErrorInfo_ErrorTooltip.zip
Children