Click here to Skip to main content
15,908,175 members
Home / Discussions / C#
   

C#

 
GeneralRe: Open File Pin
Richard Andrew x6415-Jul-21 13:49
professionalRichard Andrew x6415-Jul-21 13:49 
GeneralRe: Open File Pin
Pete O'Hanlon17-Jul-21 22:38
mvePete O'Hanlon17-Jul-21 22:38 
GeneralRe: Open File Pin
f6118-Jul-21 6:33
f6118-Jul-21 6:33 
QuestionNeed a suggestion Pin
simpledeveloper14-Jul-21 7:47
simpledeveloper14-Jul-21 7:47 
AnswerRe: Need a suggestion Pin
OriginalGriff14-Jul-21 8:05
mveOriginalGriff14-Jul-21 8:05 
GeneralRe: Need a suggestion Pin
simpledeveloper14-Jul-21 14:48
simpledeveloper14-Jul-21 14:48 
GeneralRe: Need a suggestion Pin
OriginalGriff14-Jul-21 19:03
mveOriginalGriff14-Jul-21 19:03 
GeneralRe: Need a suggestion Pin
simpledeveloper15-Jul-21 22:03
simpledeveloper15-Jul-21 22:03 
GeneralRe: Need a suggestion Pin
Richard Deeming15-Jul-21 22:38
mveRichard Deeming15-Jul-21 22:38 
AnswerRe: Need a suggestion Pin
Gerry Schmitz14-Jul-21 19:11
mveGerry Schmitz14-Jul-21 19:11 
AnswerRe: Need a suggestion Pin
Eddy Vluggen15-Jul-21 9:20
professionalEddy Vluggen15-Jul-21 9:20 
AnswerRe: Need a suggestion Pin
Mycroft Holmes15-Jul-21 12:37
professionalMycroft Holmes15-Jul-21 12:37 
GeneralRe: Need a suggestion Pin
simpledeveloper15-Jul-21 21:55
simpledeveloper15-Jul-21 21:55 
AnswerRe: Need a suggestion Pin
jschell17-Jul-21 10:26
jschell17-Jul-21 10:26 
Questionc# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien14-Jul-21 2:55
Maximilien14-Jul-21 2:55 
AnswerRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 3:01
mveRichard Deeming14-Jul-21 3:01 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien14-Jul-21 4:38
Maximilien14-Jul-21 4:38 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 4:48
mveRichard Deeming14-Jul-21 4:48 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien14-Jul-21 9:35
Maximilien14-Jul-21 9:35 
I decided to create a simple test application, a simple C#/WPF project, just a main window with a couple of controls.

I have resources in English and French. (1 string, English and French translation)
<Window x:Class="TestLayout.MainWindow"
                 xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
                 xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
                 xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
                 xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
                 xmlns:localization="clr-namespace:TestLayout.Localization"
                 mc:Ignorable="d"
                 Title="TestLayout" Height="450" Width="800">

<pre>
<StackPanel>
    <Button Margin="10" Padding="5" Click="Button_Click">Click to change language</Button>
    <Label Content="{x:Static localization:MyApp.General_Settings}"/>
</StackPanel>




With a simple callback.
<pre lang="C#">private void Button_Click(object sender, RoutedEventArgs e)
{
    var cultureInfo = CultureInfo.CreateSpecificCulture("fr");
    Thread.CurrentThread.CurrentCulture = cultureInfo;
    Thread.CurrentThread.CurrentUICulture = cultureInfo;
    CultureInfo.DefaultThreadCurrentCulture = cultureInfo;
    CultureInfo.DefaultThreadCurrentUICulture = cultureInfo;

    var resourceManager = MyApp.ResourceManager;
    var translatedString = resourceManager.GetString("General_Settings"); // the string return is Correctly translated.

}</pre>

The strings are OK, Seems the UI is not updated. Frown | :(

Thanks,

will keep keeping on.
CI/CD = Continuous Impediment/Continuous Despair

GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Richard Deeming14-Jul-21 21:32
mveRichard Deeming14-Jul-21 21:32 
GeneralRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Maximilien15-Jul-21 1:11
Maximilien15-Jul-21 1:11 
AnswerRe: c# / wpf/ xaml changing culture (language) at runtime Pin
Gerry Schmitz14-Jul-21 5:20
mveGerry Schmitz14-Jul-21 5:20 
QuestionN-Tier best practices when using in MVC application Pin
Member 949196213-Jul-21 13:33
Member 949196213-Jul-21 13:33 
AnswerRe: N-Tier best practices when using in MVC application Pin
Gerry Schmitz14-Jul-21 5:14
mveGerry Schmitz14-Jul-21 5:14 
QuestionExperiencing Memory Leak and unable to Handle it with GC.Collect() Pin
rahulgorai13-Jul-21 7:35
rahulgorai13-Jul-21 7:35 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.