Wpf ICollectionView Binding item cannot resolve property of type object
c#, icollectionview, wpf, xaml
Solution
The warnings that Resharper is giving you in the XAML view is because the design-time view of the control does not know what type it's data-context is. You can use a d:DesignInstance to help with your bindings.
Add the following (replacing Assembly/Namespace/Binding Target names appropriately)
<UserControl x:Class="MyNamespace.UserControl1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
xmlns:mc="http://schemas.openxmlformats.org/markup‐compatibility/2006"
mc:Ignorable="d"
xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
xmlns:lcl="clr‐namespace:MyAssembly"
d:DataContext="{d:DesignInstance Type=lcl:ViewModel}">
Problem
I have bound a `GridView` with an `ICollectionView` in the XAML designer the properties are not known because the entity in the `CollectionView` have been transformed into type `Object` and the entity properties can't be accessed, it runs fine no error but the designer shows it as an error, if I bind to the collection I can access the properties fine Example the entity is a `Person` with a `string Name` property I place them in an `ObservableCollection<Person>` and get the view from it and bind it to the `GridView.ItemsSource` now when I try to set the column header `DataMemberBinding.FirstName` property the designer shows it as an error Cannot Resolve property 'FirstName' in data Context of type object Is it a bug or is it Resharper playing tricks on me Sample code: ``` public class Person { public string FirstName{ get { return _firstName; } set { SetPropertyValue("FirstName", ref _firstName, value); } } } public class DataService { public IDataSource DataContext { get; set; } public ICollectionView PersonCollection{ get; set; } public DataService() { DataContext = new DataSource(); //QueryableCollectionView is from Telerik //but if i use any other CollectionView same thing //DataContext Persons is an ObservableCollection<Person> Persons PersonCollection = new QueryableCollectionView(DataContext.Persons); } } <telerik:RadGridView x:Name="ParentGrid" ItemsSource="{Binding DataService.PersonCollection}" AutoGenerateColumns="False"> <telerik:RadGridView.Columns > <telerik:GridViewDataColumn Header="{lex:Loc Key=FirstName}" DataMemberBinding="{Binding FirstName}"/> </telerik:RadGridView.Columns> </telerik:RadGridView> ```