Bonjour tout le monde !
Je tente de lié des donnée d'un fichier XML vers mon interface WPF grâce à Linq To XML. Ci-dessous, l'erreur retourné et les codes:
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2 The type of the expression in the select clause is incorrect. Type inference failed in the call to 'Select'.
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4 IEnumerable<string> datas = from d in XDocument.Load(@"Resources\limits.xml").Descendants("limits") where (int)d.Element("ID") == id select d.Elements;
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11 <StackPanel> <TextBlock Text="{Binding XPath=explicationTitle}" FontWeight="Bold" Margin="10" /> <TextBlock Text="{Binding XPath=explicationDescription}" Margin="10" /> <TextBlock Text="Aucune" FontWeight="Bold" Margin="10" /> <TextBlock Text="{Binding XPath=explicationLimiteAucune}" Margin="10" /> <TextBlock Text="Modérée" FontWeight="Bold" Margin="10" /> <TextBlock Text="{Binding XPath=explicationLimiteModeree}" Margin="10" /> <TextBlock Text="Totale" FontWeight="Bold" Margin="10" /> <TextBlock Text="{Binding XPath=explicationLimiteTotale}" Margin="10" /> </StackPanel>Si vous avez une idée de comment gérer ce petit soucis, je suis preneur
Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33 <Limits xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"> <Limit> <Id>1</Id> <title>Ma première limite :)</title> <description>NFC West</description> <explication> information de bla blabla </explication> <explicationTitle>Poney</explicationTitle> <explicationDescription>Description de la limitation</explicationDescription> <explicationLimiteAucune>Aucune limite..tout va bien :)</explicationLimiteAucune> <explicationLimiteModeree>Quelques soucis, rien de grave</explicationLimiteModeree> <explicationLimiteTotale>Gros soucis :)</explicationLimiteTotale> </Limit> <Limit> <Id>2</Id> <title>Limitation 2</title> <description>NFC West</description> <explication> information 2 de 2 bla blabla 2 2 2 </explication> <explicationTitle>Poney</explicationTitle> <explicationDescription>Description de la limitation</explicationDescription> <explicationLimiteAucune>Aucune limite..tout va bien :)</explicationLimiteAucune> <explicationLimiteModeree>Quelques soucis, rien de grave</explicationLimiteModeree> <explicationLimiteTotale>Gros soucis :)</explicationLimiteTotale> </Limit> </Limits>
Bien à vous !
Partager