0

I have written code for changing the culture dynamically , it is working properly only for the strings that are coming as dynamic resource, but not for those strings which are binded to a property. Can anybody suggest here what to do?

My code for XAML:

<TextBlock Grid.Column="0" 
           Grid.Row="1" 
           Text="{Binding ServerInstanceName}" 
           Margin="0,0,16,24" 
           HorizontalAlignment="Right" />

Here ServerInstanceName is written differently in English as compared to any other language. On changing language everything else is getting converted to the newer language but not the value of ServerInstaneName.

I have already tried :

SO: Question WPF XAML Bindings and CurrentCulture Display

and this is not working as constructor in xaml.cs would not be called again when culture changes dynamically.

Also tried this:

SO: How to display dynamic culture formatted number in a WPF UserControl

I can't reload module or the user control.

Alexander Schmidt
  • 5,631
  • 4
  • 39
  • 79
mukul nagpal
  • 93
  • 1
  • 12
  • You should share your view model too. – Alexander Schmidt Oct 06 '17 at 07:28
  • Property in the view Model looks like: public string ServerInstanceName { get { return _serverInstanceName; } set { SetProperty(ref this._serverInstanceName, value); Profile.DbServerInstanceName = value; RaiseCanExecuteChanged(); Profile.IsConnectButtonEnter = true; } } – mukul nagpal Oct 06 '17 at 07:39
  • "Culture of value"? If you want to change the text, you should set the ServerInstanceName property to whatever string you want to be displayed in the TextBlock. – mm8 Oct 06 '17 at 09:38

0 Answers0