XAML デザイナーでをバインドしGridView
ましたが、エンティティが型に変換されており、エンティティ プロパティにアクセスできないため、プロパティが不明です。正常に実行され、エラーは発生しませんが、デザイナーはそれをエラーとして表示します。コレクションにバインドすると、プロパティに問題なくアクセスできますICollectionView
CollectionView
Object
エンティティがプロパティを持つ例で、それらを に配置し、Person
そこからビューを取得し、それをバインドして、列ヘッダープロパティを設定しようとすると、デザイナーはそれをエラーとして表示しますstring Name
ObservableCollection<Person>
GridView.ItemsSource
DataMemberBinding.FirstName
タイプ オブジェクトのデータ コンテキストでプロパティ 'FirstName' を解決できません
それはバグですか、それともResharperが私にいたずらをしているのですか
サンプルコード:
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>