This is a migrated thread and some comments may be shown as answers.

how to set ErrorIndicator to visible code behide?

3 Answers 53 Views
GridView
This is a migrated thread and some comments may be shown as answers.
runer
Top achievements
Rank 1
runer asked on 02 May 2017, 02:20 AM

In GridViewRowTemplate - ValueStates - RowInvalid VisualState, there is a storyboard to change ErrorIndicator.Visibility to Visible, but how can I change it in code behide?

I've tried

VisualStateManager.GoToElementState(row, "Invalid", true);

,but it seems no working.

3 Answers, 1 is accepted

Sort by
0
Martin
Telerik team
answered on 04 May 2017, 02:24 PM
Hi,

I think the VisualState you might be looking for is named RowInvalid rather than Invalid. Furthermore, this somewhat depends on the theme you are using, because in our newer themes we might be showing these elements using Triggers or other method.

So you might want to invalidate the row through GridView's RowValidating event and show the appropriate visual elements automatically. You can find information about achieving that in the following article.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
0
runer
Top achievements
Rank 1
answered on 06 May 2017, 01:45 AM

I'm using IDataErrorInfo to validate model data, but if the column is not in viewport, the validation methods will not work, so I add a RowStyleSelector according to this thread

Validation result is not visible

If my 'fake' error style is different from the 'real' one, it will be weird to user.

I've tried 'RowInvalid', but it seems no work.

Any suggestion will be appreciated.

0
Martin
Telerik team
answered on 10 May 2017, 11:33 AM
Hi,

If you are using a style selector for the rows, you can find and extract the default style and template that we are providing for the theme that you are using, copy it and make modifications to it so you could have the same visual appearance for your custom style. It is in the Telerik.Windows.Controls.GridView.xaml and is named GridViewRowStyle and GridViewRowTemplate.

As for the thread you have linked - it is from more than 6 years ago and it is stated there that you should turn off the UI virtualization, which I have to tell you is strongly not recommended, as your application's resource usage might increase and the performance might drop significantly.

Regards,
Martin
Telerik by Progress
Want to extend the target reach of your WPF applications, leveraging iOS, Android, and UWP? Try UI for Xamarin, a suite of polished and feature-rich components for the Xamarin framework, which allow you to write beautiful native mobile apps using a single shared C# codebase.
Tags
GridView
Asked by
runer
Top achievements
Rank 1
Answers by
Martin
Telerik team
runer
Top achievements
Rank 1
Share this question
or