Click here to Skip to main content
15,888,802 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi everyone,

I'm learning WPF (just starting).

This is my problem

I have created two user control which are a menu in french and a menu in english

I will later create a method to change the language used in my application depending on the user preferences.

Now I successfully display a menu in french or english depending on the value of my variable languageToUse

However I will also give the possibility to the user to choose the font he wants for all the UIElements.

The menu now is contained into spreadsheetMenu, the font is contained into fontToUse and fontSizeToUse.

I'm looking to bind the font (fontToUse) and the fontSize (fontSizeToUse) to the menu (spreadsheetMenu).

Or do I have to bind all the menus English and French to the variables fontToUse and fontSizeToUse?

Anyone can help?

C#
//If the fontToUse is empty
if (fontToUse == null)
{
     //Set the font to the font per default
    fontToUse = fontFamilyPerDefault;
}

//If the fontSizeToUse is null
if (fontSizeToUse == 0)
{
     //Set the font size to the size per default
     fontSizeToUse = fontSizePerDefault;
}

//If the languageToUse is English
if (languageToUse == "English")
{
     //Display the menu in English
     spreadsheetMenu = new Menus.MenuInEnglish();
     MenuPanel.Children.Add(spreadsheetMenu);

}


Here should be binding The fontToUse and fontSizeToUse to the
spreadsheetMenu.

That's what I'm looking for

Thanks in advance for your help
Posted
Updated 15-Apr-12 11:13am
v2

1 solution

 
Share this answer
 
Comments
thierry maillot cardiff 17-Apr-12 0:16am    
Good information about wpf binding, thanks for that but not really what i'm looking for.


Thanks anyway for this

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