I am using the following code to populate a wpf datagrid with items in my db4o OODB:
IObjectContainer db = Db4oEmbedded.OpenFile(Db4oEmbedded.NewConfiguration(), "C:\Dev\ContractKeeper\Database\ContractKeeper.yap");
var contractTypes = db.Query(typeof(ContractType));
this.dataGrid1.ItemsSource = contractTypes.ToList();
Here is the XAML:
<Window x:Class="ContractKeeper.Window1"
xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
xmlns:x="http://schemas.microsoft.com/winfx/2开发者_开发百科006/xaml"
xmlns:dg="http://schemas.microsoft.com/wpf/2008/toolkit"
Title="Window1" Height="300" Width="300">
<Grid>
<dg:DataGrid AutoGenerateColumns="True" Margin="12,102,12,24" Name="dataGrid1" />
</Grid>
</Window>
When the items get bound to the datagrid, the gridlines appear like there are records but no data is displayed. Has anyone had this issue with db4o and the wpf datagrid?
I have resolved my issue. However, I do not entirely understand what was going on. If I figure it out, I will update this post.
精彩评论