How to change combobox item text translation?How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How to enumerate an enum?How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How do I generate a random int number?How to define 'Attached property' as 'SelectedValuePath' in ComboBox?Populating Combobox from database dynamicallyWhat is a NullReferenceException, and how do I fix it?Change MenuItem text in ASP.NET / C#
How to visualize an ordinal variable predicting a continuous outcome?
How do my husband and I get over our fear of having another difficult baby?
Is it possible for a company to grow but its stock price stays the same or decrease?
How does JS split work on Arabic plus English number strings?
How to compare integers in Tex?
What is the meaning of colored vials next to some passive skills
Create the same subfolders in another folder
Smallest PRIME containing the first 11 primes as sub-strings
How is the Apple Watch ECG disabled in certain countries?
Can an energy drink or chocolate before an exam be useful ? What sort of other edible goods be helpful?
Why would an airline put 15 passengers at once on standby?
Would a 737 pilot use flaps in nose dive?
How important is knowledge of trig identities for use in Calculus
French license plates
What are one's options when facing religious discrimination at the airport?
Is is possible to take a database offline when doing a backup using an sql job?
Fix Ethernet 10/100 PoE cable with 7 out of 8 wires alive
If a spaceship ran out of fuel somewhere in space between Earth and Mars, does it slowly drift off to the Sun?
When did Unix stop storing passwords in clear text?
GPLv3 forces us to make code available, but to who?
How to identify whether a publisher is genuine or not?
A word that refers to saying something in an attempt to anger or embarrass someone into doing something that they don’t want to do?
Is it ok if I haven't decided my research topic when I first meet with a potential phd advisor?
Contour integration with infinite poles
How to change combobox item text translation?
How do I calculate someone's age in C#?How do you give a C# Auto-Property a default value?How to enumerate an enum?How do I create an Excel (.XLS and .XLSX) file in C# without installing Microsoft Office?How do I get a consistent byte representation of strings in C# without manually specifying an encoding?How do I generate a random int number?How to define 'Attached property' as 'SelectedValuePath' in ComboBox?Populating Combobox from database dynamicallyWhat is a NullReferenceException, and how do I fix it?Change MenuItem text in ASP.NET / C#
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
How to change ComboBox Items text translation? I have combobox where i select language. Application language is changing but it cant change text of checkbox items to selected language.
my xaml:
<ComboBox HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Width="120" ItemsSource="Binding Path=Languages" SelectedItem="Binding Path=SLanguage, Mode=TwoWay" DisplayMemberPath="LanguageName" IsTabStop="False"/>
my VM:
private ObservableCollection<LanguageSelector> _languages;
public ObservableCollection<LanguageSelector> Languages
get return _languages;
set
_languages = value;
private LanguageSelector _slanguage;
public LanguageSelector SLanguage
get return _slanguage;
set
_slanguage = value;
ChangeSelectedLang();
private void ChangeSelectedLang()
if (SLanguage.Id == 1)
CultureInfo.CurrentCulture = new CultureInfo("pl-PL");
SetLanguageDictionary();
else
CultureInfo.CurrentCulture = new CultureInfo("en-EN");
SetLanguageDictionary();
private void SetLanguageDictionary()
ResourceDictionary dict = new ResourceDictionary();
switch (Thread.CurrentThread.CurrentCulture.ToString())
case "pl-PL":
dict.Source = new Uri("..\Resources\LanguagePL.xaml", UriKind.Relative);
break;
case "en-EN":
dict.Source = new Uri("..\Resources\LanguageEN.xaml", UriKind.Relative);
break;
default:
dict.Source = new Uri("..\Resources\Language.xaml", UriKind.Relative);
break;
Application.Current.Resources.MergedDictionaries.Add(dict);
public void FillCombo()
Languages = new ObservableCollection<LanguageSelector>()
new LanguageSelector()Id=1, LanguageName=Application.Current.FindResource("pl-PL") as string
,new LanguageSelector()Id=2, LanguageName=Application.Current.FindResource("en-EN") as string
;
this.SLanguage = Languages.FirstOrDefault();
in my direcory i have:
<system:String x:Key="pl-PL">Polski</system:String>
<system:String x:Key="en-EN">Angielski</system:String>
i want switch combobox items text to selected language when i change it for EN ex. Polski to Polish
c# wpf mvvm
add a comment
|
How to change ComboBox Items text translation? I have combobox where i select language. Application language is changing but it cant change text of checkbox items to selected language.
my xaml:
<ComboBox HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Width="120" ItemsSource="Binding Path=Languages" SelectedItem="Binding Path=SLanguage, Mode=TwoWay" DisplayMemberPath="LanguageName" IsTabStop="False"/>
my VM:
private ObservableCollection<LanguageSelector> _languages;
public ObservableCollection<LanguageSelector> Languages
get return _languages;
set
_languages = value;
private LanguageSelector _slanguage;
public LanguageSelector SLanguage
get return _slanguage;
set
_slanguage = value;
ChangeSelectedLang();
private void ChangeSelectedLang()
if (SLanguage.Id == 1)
CultureInfo.CurrentCulture = new CultureInfo("pl-PL");
SetLanguageDictionary();
else
CultureInfo.CurrentCulture = new CultureInfo("en-EN");
SetLanguageDictionary();
private void SetLanguageDictionary()
ResourceDictionary dict = new ResourceDictionary();
switch (Thread.CurrentThread.CurrentCulture.ToString())
case "pl-PL":
dict.Source = new Uri("..\Resources\LanguagePL.xaml", UriKind.Relative);
break;
case "en-EN":
dict.Source = new Uri("..\Resources\LanguageEN.xaml", UriKind.Relative);
break;
default:
dict.Source = new Uri("..\Resources\Language.xaml", UriKind.Relative);
break;
Application.Current.Resources.MergedDictionaries.Add(dict);
public void FillCombo()
Languages = new ObservableCollection<LanguageSelector>()
new LanguageSelector()Id=1, LanguageName=Application.Current.FindResource("pl-PL") as string
,new LanguageSelector()Id=2, LanguageName=Application.Current.FindResource("en-EN") as string
;
this.SLanguage = Languages.FirstOrDefault();
in my direcory i have:
<system:String x:Key="pl-PL">Polski</system:String>
<system:String x:Key="en-EN">Angielski</system:String>
i want switch combobox items text to selected language when i change it for EN ex. Polski to Polish
c# wpf mvvm
You need raise event PropertyChanged for property Languages
– Lana Pelmeshkina
Mar 28 at 19:59
You need to implementINotifyPropertyChanged...
– Çöđěxěŕ
Mar 28 at 19:59
I try this but still don't work :( i use public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(String propertyName) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); end then: OnPropertyChanged("Languages"); in set property of Languages
– Rot
Mar 28 at 20:24
You should call OnPropertyChanged("SLanguage"); in set property of SLanguage and set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=OnPropertyChanged".
– Mathivanan KP
Mar 29 at 4:45
still not working. I have no idea why. I set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" because OnPropertyChanged i get error :Requested value 'OnPropertyChanged' was not found i xaml.
– Rot
Mar 29 at 7:07
add a comment
|
How to change ComboBox Items text translation? I have combobox where i select language. Application language is changing but it cant change text of checkbox items to selected language.
my xaml:
<ComboBox HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Width="120" ItemsSource="Binding Path=Languages" SelectedItem="Binding Path=SLanguage, Mode=TwoWay" DisplayMemberPath="LanguageName" IsTabStop="False"/>
my VM:
private ObservableCollection<LanguageSelector> _languages;
public ObservableCollection<LanguageSelector> Languages
get return _languages;
set
_languages = value;
private LanguageSelector _slanguage;
public LanguageSelector SLanguage
get return _slanguage;
set
_slanguage = value;
ChangeSelectedLang();
private void ChangeSelectedLang()
if (SLanguage.Id == 1)
CultureInfo.CurrentCulture = new CultureInfo("pl-PL");
SetLanguageDictionary();
else
CultureInfo.CurrentCulture = new CultureInfo("en-EN");
SetLanguageDictionary();
private void SetLanguageDictionary()
ResourceDictionary dict = new ResourceDictionary();
switch (Thread.CurrentThread.CurrentCulture.ToString())
case "pl-PL":
dict.Source = new Uri("..\Resources\LanguagePL.xaml", UriKind.Relative);
break;
case "en-EN":
dict.Source = new Uri("..\Resources\LanguageEN.xaml", UriKind.Relative);
break;
default:
dict.Source = new Uri("..\Resources\Language.xaml", UriKind.Relative);
break;
Application.Current.Resources.MergedDictionaries.Add(dict);
public void FillCombo()
Languages = new ObservableCollection<LanguageSelector>()
new LanguageSelector()Id=1, LanguageName=Application.Current.FindResource("pl-PL") as string
,new LanguageSelector()Id=2, LanguageName=Application.Current.FindResource("en-EN") as string
;
this.SLanguage = Languages.FirstOrDefault();
in my direcory i have:
<system:String x:Key="pl-PL">Polski</system:String>
<system:String x:Key="en-EN">Angielski</system:String>
i want switch combobox items text to selected language when i change it for EN ex. Polski to Polish
c# wpf mvvm
How to change ComboBox Items text translation? I have combobox where i select language. Application language is changing but it cant change text of checkbox items to selected language.
my xaml:
<ComboBox HorizontalAlignment="Left" Margin="10,0,0,0" VerticalAlignment="Center" Width="120" ItemsSource="Binding Path=Languages" SelectedItem="Binding Path=SLanguage, Mode=TwoWay" DisplayMemberPath="LanguageName" IsTabStop="False"/>
my VM:
private ObservableCollection<LanguageSelector> _languages;
public ObservableCollection<LanguageSelector> Languages
get return _languages;
set
_languages = value;
private LanguageSelector _slanguage;
public LanguageSelector SLanguage
get return _slanguage;
set
_slanguage = value;
ChangeSelectedLang();
private void ChangeSelectedLang()
if (SLanguage.Id == 1)
CultureInfo.CurrentCulture = new CultureInfo("pl-PL");
SetLanguageDictionary();
else
CultureInfo.CurrentCulture = new CultureInfo("en-EN");
SetLanguageDictionary();
private void SetLanguageDictionary()
ResourceDictionary dict = new ResourceDictionary();
switch (Thread.CurrentThread.CurrentCulture.ToString())
case "pl-PL":
dict.Source = new Uri("..\Resources\LanguagePL.xaml", UriKind.Relative);
break;
case "en-EN":
dict.Source = new Uri("..\Resources\LanguageEN.xaml", UriKind.Relative);
break;
default:
dict.Source = new Uri("..\Resources\Language.xaml", UriKind.Relative);
break;
Application.Current.Resources.MergedDictionaries.Add(dict);
public void FillCombo()
Languages = new ObservableCollection<LanguageSelector>()
new LanguageSelector()Id=1, LanguageName=Application.Current.FindResource("pl-PL") as string
,new LanguageSelector()Id=2, LanguageName=Application.Current.FindResource("en-EN") as string
;
this.SLanguage = Languages.FirstOrDefault();
in my direcory i have:
<system:String x:Key="pl-PL">Polski</system:String>
<system:String x:Key="en-EN">Angielski</system:String>
i want switch combobox items text to selected language when i change it for EN ex. Polski to Polish
c# wpf mvvm
c# wpf mvvm
asked Mar 28 at 19:54
RotRot
11 bronze badge
11 bronze badge
You need raise event PropertyChanged for property Languages
– Lana Pelmeshkina
Mar 28 at 19:59
You need to implementINotifyPropertyChanged...
– Çöđěxěŕ
Mar 28 at 19:59
I try this but still don't work :( i use public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(String propertyName) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); end then: OnPropertyChanged("Languages"); in set property of Languages
– Rot
Mar 28 at 20:24
You should call OnPropertyChanged("SLanguage"); in set property of SLanguage and set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=OnPropertyChanged".
– Mathivanan KP
Mar 29 at 4:45
still not working. I have no idea why. I set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" because OnPropertyChanged i get error :Requested value 'OnPropertyChanged' was not found i xaml.
– Rot
Mar 29 at 7:07
add a comment
|
You need raise event PropertyChanged for property Languages
– Lana Pelmeshkina
Mar 28 at 19:59
You need to implementINotifyPropertyChanged...
– Çöđěxěŕ
Mar 28 at 19:59
I try this but still don't work :( i use public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(String propertyName) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); end then: OnPropertyChanged("Languages"); in set property of Languages
– Rot
Mar 28 at 20:24
You should call OnPropertyChanged("SLanguage"); in set property of SLanguage and set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=OnPropertyChanged".
– Mathivanan KP
Mar 29 at 4:45
still not working. I have no idea why. I set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" because OnPropertyChanged i get error :Requested value 'OnPropertyChanged' was not found i xaml.
– Rot
Mar 29 at 7:07
You need raise event PropertyChanged for property Languages
– Lana Pelmeshkina
Mar 28 at 19:59
You need raise event PropertyChanged for property Languages
– Lana Pelmeshkina
Mar 28 at 19:59
You need to implement
INotifyPropertyChanged...– Çöđěxěŕ
Mar 28 at 19:59
You need to implement
INotifyPropertyChanged...– Çöđěxěŕ
Mar 28 at 19:59
I try this but still don't work :( i use public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(String propertyName) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); end then: OnPropertyChanged("Languages"); in set property of Languages
– Rot
Mar 28 at 20:24
I try this but still don't work :( i use public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(String propertyName) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); end then: OnPropertyChanged("Languages"); in set property of Languages
– Rot
Mar 28 at 20:24
You should call OnPropertyChanged("SLanguage"); in set property of SLanguage and set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=OnPropertyChanged".
– Mathivanan KP
Mar 29 at 4:45
You should call OnPropertyChanged("SLanguage"); in set property of SLanguage and set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=OnPropertyChanged".
– Mathivanan KP
Mar 29 at 4:45
still not working. I have no idea why. I set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" because OnPropertyChanged i get error :Requested value 'OnPropertyChanged' was not found i xaml.
– Rot
Mar 29 at 7:07
still not working. I have no idea why. I set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" because OnPropertyChanged i get error :Requested value 'OnPropertyChanged' was not found i xaml.
– Rot
Mar 29 at 7:07
add a comment
|
0
active
oldest
votes
Your Answer
StackExchange.ifUsing("editor", function ()
StackExchange.using("externalEditor", function ()
StackExchange.using("snippets", function ()
StackExchange.snippets.init();
);
);
, "code-snippets");
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "1"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/4.0/"u003ecc by-sa 4.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405880%2fhow-to-change-combobox-item-text-translation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
0
active
oldest
votes
0
active
oldest
votes
active
oldest
votes
active
oldest
votes
Thanks for contributing an answer to Stack Overflow!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f55405880%2fhow-to-change-combobox-item-text-translation%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
You need raise event PropertyChanged for property Languages
– Lana Pelmeshkina
Mar 28 at 19:59
You need to implement
INotifyPropertyChanged...– Çöđěxěŕ
Mar 28 at 19:59
I try this but still don't work :( i use public event PropertyChangedEventHandler PropertyChanged; public void OnPropertyChanged(String propertyName) PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName)); end then: OnPropertyChanged("Languages"); in set property of Languages
– Rot
Mar 28 at 20:24
You should call OnPropertyChanged("SLanguage"); in set property of SLanguage and set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=OnPropertyChanged".
– Mathivanan KP
Mar 29 at 4:45
still not working. I have no idea why. I set SelectedItem="Binding Path=SLanguage, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged" because OnPropertyChanged i get error :Requested value 'OnPropertyChanged' was not found i xaml.
– Rot
Mar 29 at 7:07