i am using VS/SQLite/C++/xaml
I have two tables, books and order:
CREATE TABLE books(
id INT PRIMARY KEY AUTOINCREMENT,
title VARCHAR NOT NULL,
pages INT
)
CREATE TABLE order(
id INTEGER PRIMARY KEY AUTOINCREMENT,
booksID INT,
date NOT NULL,
FOREIGN KEY(booksID) REFERENCES books(id)
)
books :
1 Title1
2 Title2
3 Title3
order :
1 2 2014-3-10
2 3 2014-2-10
And in my VS/C#/xaml code, I am ready to use MyDataset and viewsources for two tables:
<Window.Resources>
<local:SmileDataSet x:Key="MyDataSet"/>
<CollectionViewSource x:Key="booksViewSource"
Source="{Binding books, Source={StaticResource MyDataSet}}"/>
<CollectionViewSource x:Key="orderViewSource"
Source="{Binding order, Source={StaticResource MyDataSet}}"/>
</Window.Resources>
I don't know how to display title of books in the above order table of a data grid.
Starting from the scratch, I've been tried several ways, but fails to display it.
The followings are some of my tries :
(codes are omitted for clarity and actually pseudo code, maybe wrong, sorry!)
<DataGrid ItemsSource="{Binding orderViewSource}">
...
<GridColumn Name="title">
<GridColumn.CellTemplate>
<DataTemplate>
<Textbox text="{Binding ...}"/>
</DataTemplate>
</GridColumn.CellTemplate>
</GridColumn>
or <textbox text="{Binding ...}">
Any comments or links are greatly appreciated !
Thanks.