I have derived a custom class from the RadGridView to expose some dependency properties, and in the XAML when I create a control and binding its ItemSource to my viewmodel, then in the design view I'm getting the below error, and due to which the design view is not appearing, can you please help me:
Error 119 The local property "ItemsSource" can only be applied to types that are derived from "DataControl".
Thanks.
Gaurav Gupta
14 Answers, 1 is accepted
Can you verify that you have all needed references in your project? Do you have Telerik.Windows.Data.dll? System.Windows.Data?
All the best,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
system.windows.data.dll anywhere, do you mean to say the PresentationFramework.dll as it contains the system.windows.data namespace. Even after adding the PresentationFramework.dll & Telerik.Windows.Data.dll in my project reference, still I'm facing the same issue.
Please open support ticket and send us the project where we can reproduce this issue.
Regards,Vlad
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I tried to reproduce the error in design time, but without any success. Could you take a look at the sample attached ? Is there anything specific that I need to do in order to get the same behavior ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
Thanks for taking the time to put together an example for me. I was not able to reproduce the error consistently in your project and it only happened when I would kill the designer process, which I'm sure is not a good thing to do anyway. Unfortunately, it must be something in my project (which is a bit more complex than this example) but regardless, I feel better knowing that telerik is not the problem. I have started a new wpf project from scratch and so far the radgridview works perfect in the designer. If I am able to isolate whatever was causing the issue I will post back here in case it may help anyone else.
I am glad to see that you work can continue without any troubles with the designer. Let me know in case you encounter any further problems with that.
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
It is very frustrating as I cannot see a visual designer and am working with some rather complex views.
We did not manage to reproduce the behavior on our side and consequently, we could not debug it and provide a solution. Could you clarify what your settings are and how you reproduce it ? Is there anything more specific ?
Maya
the Telerik team
Explore the entire Telerik portfolio by downloading Telerik DevCraft Ultimate.
I swear there is a bug in visual studio as I still get this error occassionally too; HOWEVER, I tried some new techniques which seem to work much better because I can see my views in the designer.
First, I found that when radgridview starts showing that error about system.windows.data.dll (which is weird because I don't believe there is such a lib) I could fix the error with a clean and rebuild. If that doesn't work then kiling the designer process (XDesProc.exe) from task manager and then reloading it from the designer will sometimes work. And if that doesn't, then restarting visual studio seems to do the trick.
As far as code, hopefully the following will give you some ideas as I have no idea of what your solution looks like. I use mvvmlight so I bind my viewmodels thru viewmodellocator statically in my views and I was also binding a designtime instance using d:datacontext thinking that the designer would just choose this one at design time. The designer can actually spin up either so I think I was having some kind of conflict (you can debug the designer process in a separate instance of vs just google it if you're curious). My viewmodellocator was bombing out in the getters for my viewmodels because I resolve them from an ioc container.
So I decided to rip out all of the d: designtime bindings in favor of using the real viewmodels being bound via the vml and applied some new techniques consisting of a new build configuration specifically for design with compiler directives to build designer versions of my viewmodels, which is also cool because it's an easier way to exclude designer code from your prod build.
Anyway, hopefully some part of my rambling will help you out but if you want more detail just give me a holler and I'll try to put together a simple example or something.
If you open with visual studio 2012 the Telerik CRm solution and open in design mode CRM.Companies -> CompaniesListUserControl.xaml you get this error also at:
<
telerik:RadGridView
ItemsSource
=
"{Binding Companies}"
ColumnWidth
=
"*"
Grid.Row
=
"1"
helpers:GridViewColumnHelper.HideGroupedColumns
=
"True"
helpers:GridViewColumnHelper.HideNonImportantColumns
=
"{Binding IsInOverviewState}"
SelectedItem
=
"{Binding SelectedCompany, Mode=TwoWay}"
AutoExpandGroups
=
"True"
AutoGenerateColumns
=
"False"
>
with visual studio standard settings, and rad controls version 2013.2 611.
Could yo explain wich kind of d: references you could put inside the XAMl to avoid this problem?
Thanks
Unfortunately, I am not able to get any exception on the example you mentioned as well. Will it be possible to check this small video to see whether I am missing something ? Are all the references from the folder of the application - \CRM_Trial_2013_1_0611_SourceCode\Binaries ?
Maya
Telerik
Learn what features your users use (or don't use) in your application. Know your audience. Target it better. Develop wisely.
Sign up for Free application insights >>
I am having this issue even with the 2017 Telerik build.
I have a WPF application that employs the Telerik:RadGridView on serveral Pages and User Controls. The Telerik version was originally 2016 and everything worked well (Designer view and all).
We have since upgraded our Telerik libraries to the 2017 R2. The existing telerik:RadGridView controls work well after updating the DLLs; however, I am trying to create a new User Control in a project where the Telerik libraries did not yet exist. I had to drag the RadGridView from the Toolbox to allow it the code updates for all of the required libraries. Once the IDE was finished, I immediate received the error that "The local property "ItemsSource" can only be applied to types that are derived from "DataControl""
I do have the System.Windows.Data, Telerik.Windows.Data and Telerik.Windows.Controls.GridView in my xaml.cs file.
I do have the project set for the Target framework: .NET Framework 4 Client Profile.
I have tried to mirror all aspects between my working project and my non-working project that I could change and the Designer view fails to display with the ItemsSource error. Even though the working Project has no issues showing a RadGridView with an ItemsSource property set.
Also, the problem appears to not be only limited to the Designer. In my User Control, i have a RadGridView and a WPF DataGrid. Both are pointed to the same source in a ViewModel. Yet the WPF DataGrid populates fine, but the RadGridView remains empty.
I guess the problem is related to wrongly referenced binaries.
May I ask you to check the exact version of Telerik.Windows.Controls.GridView binary is referenced to the new project and assure that all of the binaries are with the same version.
Regards,
Martin Vatev
Progress Telerik