このトピックに関連するStackOverflowに質問があることは間違いなく助かりませんでしたので、私はそれを尋ねなければなりませんもう1回。何か助けてくれてありがとう。 私は、エンティティフレームワークのコードの最初のデータベースからのデータを表示する必要があるListBoxを持っています。WPF MVVMのListBoxのデータとしてSystem.Data.Entity.DynamicProxies [解決済み]
<ListBox Grid.Column="0"
ItemsSource="{Binding PersonCollection}"
SelectedItem="{Binding ThePerson, Mode=TwoWay}">
<ItemsControl.Resources>
<DataTemplate DataType="{x:Type vm:EmployeeViewModel}">
<StackPanel Orientation="Horizontal">
<TextBlock Padding="2">
<TextBlock.Text>
<MultiBinding StringFormat=" {0} {1} {2}">
<Binding Path="ThePerson.Surname"/>
<Binding Path="ThePerson.FirstName"/>
<Binding Path="ThePerson.MidleName"/>
</MultiBinding>
</TextBlock.Text>
</TextBlock>
</StackPanel>
</DataTemplate>
</ItemsControl.Resources>
</ListBox>
私のViewModelには次のようになります:テーブルからのデータを表示するための
ThePersonとPersonCollectionがOnThePropertyChangedいるpublic EmployeeViewModel()
{
ThePerson = new Person();
_perlog = new PersonLogic();
PersonCollection = new ObservableCollection<Person>(_perlog.Get());
}
()PesonLogicで コード:
internal IEnumerable<Person> Get()
{
return _dbContext.Persons.ToList();
}
このタスクのだから私のコード
このコードはすべて、エラーSystem.Data.Entity.DynamicProxiesによって生成されます。 解決策をお手伝いできますか?私は間違っている? ご協力いただきありがとうございます。
UPD私はこの問題を次のように置き換えました。結果それ `sは