Good day,
I'm trying to get a WPF application working that has a simple GridView to display the contents of a CompanyCollection.
It seems, though, that as an ObjectDataProvider the LLBLGen Pro generated classes do not play nicely.
I have the following defined in my window:
<Window.Resources>
<ObjectDataProvider x:Key="CompanyCollectionDS" d:IsDataSource="True" ObjectType="{x:Type llblgen:CompanyCollection}" />
<DataTemplate x:Key="ItemsTemplate">
<StackPanel>
<TextBlock Text="{Binding Path=CompanyId}"/>
<TextBlock Text="{Binding Path=ContactNumber}"/>
<TextBlock Text="{Binding Path=ContactPerson}"/>
<TextBlock Text="{Binding Path=Name}"/>
</StackPanel>
</DataTemplate>
</Window.Resources>
This sets up the resources I need for my grid, primarily a data source that is of type CompanyCollection from the llblgen namespace. The llblen namespace is declared at the top of the document as the assembly/namespace which contains my generated collection classes.
Also in there is the template for the grid layout, which renders correctly.
Finally, the GridView is declared as follows:
<Grid x:Name="LayoutRoot">
<ListView d:UseSampleData="True" Margin="64,0,306,101" VerticalAlignment="Bottom" Height="100" ItemTemplate="{DynamicResource ItemsTemplate}" ItemsSource="{Binding Path=Items, Mode=Default, Source={StaticResource CompanyCollectionDS}}" IsSynchronizedWithCurrentItem="True">
<ListView.View>
<GridView AllowsColumnReorder="True">
<GridViewColumn Header="ID" DisplayMemberBinding="{Binding Path=CompanyId}" Width="50"/>
<GridViewColumn Header="Name" DisplayMemberBinding="{Binding Path=Name}" Width="200"/>
</GridView>
</ListView.View>
</ListView>
</Grid>
I have added the connection string to the App.Config file and am able to retrieve the connection string from the app through ConfigFileHelper, so I know that entry is correct.
I can create an instance of, for example, a CompanyCollection and List.Count has the right number of elements.
SOOOOO....the generated code seems to have everything it needs to get itself talking with the DB, but when the collection is used as a DS it doesn't seem to output any data.
Any ideas on WPF binding?
Cheers,
James Chambers