5

I am writting a wpf application using C# (VS2010) and when my application runs , the input language is taken from the system input language which is English.

I want my application to change the input language automatically without having to press (Shift + Alt)

Can you tell me how to do that please?

Another question, can I change the timezone in my system using my application too?

4 Answers 4

6

If you just want to change the input language for your application, look at InputLanguage.CurrentInputLanguage

Or if you want to change the system default input language look at the SystemParametersInfo function with the SPI_SETDEFAULTINPUTLANG flag.

Regarding the time zone, there is the TimeZoneInfo class to get out information but to set it you'd need to use the SetTimeZoneInformation function.

Sign up to request clarification or add additional context in comments.

2 Comments

How can I do it in WPF application?
@yadavr I'm sorry, I'm not sure what you mean. The question is regarding doing it in a WPF application.
4

I know this topic is quite old one, but should you've got here from the Google by a some search request like "wpf switch keyboard" (as have I) You should definitely try the special WPF class InputLanguageManager: http://msdn.microsoft.com/en-us/library/system.windows.input.inputlanguagemanager.aspx Especially pay attention to the one of its attached properties called InputLanguage. In most cases its all what you need.

Comments

3

You must use this function:

public static void lang(string lge)
{
    System.Globalization.CultureInfo TypeOfLanguage = new System.Globalization.CultureInfo(lge);
    InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(TypeOfLanguage);
}

and when you call this function the parameter lge must be the label of desired language for example "ar-dz" for Algerian Arabic language or "fr-fr" for French language.

Comments

0

First add

using System.Globalization;

Then write after InitializeComponent(); this code

        InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(Application.CurrentCulture);
        InputLanguage.CurrentInputLanguage = InputLanguage.FromCulture(new CultureInfo("ar-EG"));

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.