Click here to Skip to main content
15,881,204 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
i am using VS/SQLite/C++/xaml
I have two tables, books and order:
SQL
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:
HTML
<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!)
HTML
<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.
Posted
Updated 23-Apr-14 18:38pm
v6

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900