Hello,
I have an xml with some tranlations:
<?xml version="1.0" encoding="utf-8"?><Lista> <Idioma nome="PT"> <Traducao src="Rede" mean="Rede" /><Traducao src="Perfil" mean="Perfil" /><Traducao src="Config" mean="Configuracao" /></Idioma><Idioma nome="EN"><Traducao src="Rede" mean="Network" /><Traducao src="Perfil" mean="Profile" /><Traducao src="Config" mean="Config" /></Idioma></Lista>
My static class:
public static class Traducao
{
public static List<Idioma> Idiomas { get; set; }
public static int LinguaSelecionada { get; set; }
static Traducao()
{
Idiomas = new List<Idioma>();
XmlTextReader reader = new XmlTextReader("traducao.xml");
while (reader.Read())
{
if (reader.GetAttribute("nome") != null)
{
Idiomas.Add(new Idioma(reader.GetAttribute("nome")));
}
}
}
}My other class (Idioma):
public class Idioma
{
public Dictionary<string, string> Dicionario = new Dictionary<string, string>();
public string idioma { get; set; }
public Idioma(string lang)
{
idioma = lang;
CarregaTraducao();
}
public void CarregaTraducao()
{
XmlDocument doc = new XmlDocument();
doc.Load("traducao.xml");
var nodesList = doc.SelectNodes("Lista/Idioma[@nome='" + idioma + "']/Traducao");
foreach (XmlNode node in nodesList)
{
Dicionario.Add(node.Attributes["src"].Value, node.Attributes["mean"].Value);
}
}
}My menu:
How can I put my Buttons Content, Binding for these situation?
I know how to do it with methods, but I'd like to know of how can I do it with Bindind.
Regards, ADAE.