Bonjour,
J'ai crée un nouveau projet WPF avec un fichier de conf.xaml :

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
<ResourceDictionary
        xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
        xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib">
 
    <sys:String x:Key="app_id" x:Name="app_id">com.blabla.complete</sys:String>
 
    <!-- URL -->
 
    <sys:String x:Key="urlServeur">http:/*****.com/</sys:String>
    <sys:String x:Key="queryLocal">fr</sys:String>
    <sys:String x:Key="urlMobile">http://www.****.com/mobile</sys:String>
    <sys:String x:Key="urlFB">http://www.facebook.com/pages/***/****</sys:String>
 
    <sys:String x:Key="email_cc">annonces@***.com</sys:String>
 
    <sys:String x:Key="autentification_key">***</sys:String>
    <sys:String x:Key="bing_key">****</sys:String>
 
</ResourceDictionary>
Mon app.xaml :

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
<Application x:Class="Geoimmo_Tablette.App"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             StartupUri="MainWindow.xaml">
 
    <!--Ressources d'applications-->
    <Application.Resources>
       <ResourceDictionary>
            <ResourceDictionary.MergedDictionaries>
                <ResourceDictionary Source="conf.xaml"/>
                <ResourceDictionary Source="Ressource/string.xaml"/>
               <ResourceDictionary Source="{Binding Source={StaticResource app_id}, StringFormat='\{0\}/conf.xaml'}"/>
 
             <ResourceDictionary Source="Ressource/style.xaml"/>
            </ResourceDictionary.MergedDictionaries>
 
        </ResourceDictionary>
    </Application.Resources>
</Application>
et j'essaie de récupérer la string app_id du fichier conf.xaml dans la classe app.xaml.cs comme ceci :

Code : Sélectionner tout - Visualiser dans une fenêtre à part
1
2
3
4
5
6
7
8
 public App()
        {
 
            string app_id               = App.Current.Resources["app_id"] as string;
 
 
            MessageBox.Show(app_id);
        }
Mais ca ne fonctionne pas :-/ Quelqu'un peut t'il me dire d'ou vient le probleme ? En vous remerciant par avance.