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

Dynamic columns binding with special datatype

6 Answers 245 Views
GridView
This is a migrated thread and some comments may be shown as answers.
Ning
Top achievements
Rank 1
Ning asked on 31 May 2017, 10:57 AM

Dear Admin

I just use RadGridView control for excel content shown in MVVM pattern, and before amount excel data, I do not know exact columns and rows shown in RadGridView, so I use datatable as my datasource binded to RadGridView's ItemsSource. But actually I would like to change some columns  datatype from string to Image, I try to add AutoGeneratingColumn event and set CellTemplate for specified columns, and the result was that there was no response after loading and only shut-down whole window.

so in this case is there any other workaround to archive similar case? any ideas I do really appreciate.

6 Answers, 1 is accepted

Sort by
0
Yoan
Telerik team
answered on 05 Jun 2017, 08:43 AM
Hello,

This is strange behavior. Are you using the DefaultView of the DataTable? If not, can you try it? I have attached a sample project which is similar to your requirement. Please give it a try and let me know if it helps.

Regards,
Yoan
Progress Telerik
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Ning
Top achievements
Rank 1
answered on 06 Jun 2017, 02:11 AM

Dear Yoan

I just tried it and worked well, but one more thing is image column information is different and I need to set binding for it, in my data template I just use column name as property path during instantiating binding, that issue occured. I'm sorry for my unclear description.

And if I use interaction behavior(generating GridViewDataColumn and GridViewImageColumn in code-behind dynamically and set binding column into custom columnsbindingbehavior implemented from Behvior<RadGridView>), result is OK but the issue is there were 10~30s no responding time. it is really strange.

0
Accepted
Martin Ivanov
Telerik team
answered on 08 Jun 2017, 04:48 PM
Hello Ning,

Thanks for the additional info. We'll check it later and get back to you.

Regards,
Martin Ivanov
Progress Telerik
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
Yoan
Telerik team
answered on 12 Jun 2017, 08:29 AM
Hi,

I have modified my project so it meets your scenario and it works as expected. May I ask you to check it and let me know if I am missing something? If this is the case, can you provide a code snippet which will help me to reproduce the problem?

Regards,
Yoan
Progress Telerik
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 you to write beautiful native mobile apps using a single shared C# codebase.
0
Ning
Top achievements
Rank 1
answered on 14 Jun 2017, 12:15 AM

Dear Yoan

Thanks a lot for your support, It works well. And I just tried to find out reason of my problem, I think it should be caused by finding resources , sometimes we code with MVVM pattern and use system.windows.application.current.TryToFindResource to get specified resource but result was error or null, and later I will attch a code snippet about no responding with interaction way.

0
Yoan
Telerik team
answered on 15 Jun 2017, 02:52 PM
Hi,

I will close this thread for now. Please, do not hesitate to open it if you encounter any problems.

Regards,
Yoan
Progress Telerik
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
Ning
Top achievements
Rank 1
Answers by
Yoan
Telerik team
Ning
Top achievements
Rank 1
Martin Ivanov
Telerik team
Share this question
or