WPF – Lire un fichier XML dans un gridview

Code XAML :
< Grid >
< ListView Name=”List1″ Margin=”35,34,28,123″ ItemTemplate=”{DynamicResource CustomerTemplate}” ItemsSource=”{Binding Path=Table}”>
< ListView.View>
< GridView>
< GridViewColumn Header=”Marque” DisplayMemberBinding=”{Binding Path=marque}”/>
< GridViewColumn Header=”Modele” DisplayMemberBinding=”{Binding Path=modele}”/>
< GridViewColumn Header=”Vitesse” DisplayMemberBinding=”{Binding Path=vitesse}”/>
< /GridView>
< /ListView.View>
< /ListView>
< /Grid>
Code Behind :
// lecture du fichier xml dans un gridview
string file = @”c:testxmlData1.xml”;
DataSet ds = new DataSet(“Table”);
List1.DataContext = ds.Tables[0].DefaultView;


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s