cultureinfo

How to specify XAML value (e.g. converter parameter) culture

雨燕双飞 提交于 2020-05-13 06:16:06
问题 When we use static double values in XAML, how can we specify in which format they are provided? Example: <Rectangle> <Rectangle.Opacity> <Binding Path="IsDimmed" Converter="{StaticResource boolToDoubleConverter}" ConverterParameter="0.8"/> </Rectangle.Opacity> </Rectangle> with the converter method public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture) { return double.Parse((string)parameter, culture); } The problem is that on a

Using Custom Culture with ReportViewer returns a CultureNotFoundException

青春壹個敷衍的年華 提交于 2020-02-03 21:32:54
问题 My web site uses custom cultures that are created like this: var cib = new CultureAndRegionInfoBuilder("en-gb-xxxx", CultureAndRegionModifiers.None); cib.LoadDataFromCultureInfo(new CultureInfo("en-gb")); cib.LoadDataFromRegionInfo(new RegionInfo("en")); cib.Register(); And that are used like this: Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-gb-xxxx"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-gb-xxxx"); It is all working fine up to the point

Using Custom Culture with ReportViewer returns a CultureNotFoundException

走远了吗. 提交于 2020-02-03 21:32:08
问题 My web site uses custom cultures that are created like this: var cib = new CultureAndRegionInfoBuilder("en-gb-xxxx", CultureAndRegionModifiers.None); cib.LoadDataFromCultureInfo(new CultureInfo("en-gb")); cib.LoadDataFromRegionInfo(new RegionInfo("en")); cib.Register(); And that are used like this: Thread.CurrentThread.CurrentCulture = CultureInfo.CreateSpecificCulture("en-gb-xxxx"); Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-gb-xxxx"); It is all working fine up to the point

CultureInfo is not consistent between windows versions

可紊 提交于 2020-01-23 13:28:31
问题 Has anyone noticed that on different versions of Windows the CultureInfo format will result in a different pattern? Windows 7 created dddd, MMMM dd, YYYY Sample output: Windows 7 Both Windows 10 & Windows Server 2012 created dddd, MMMM d, YYYY Sample output: Windows 10 & Server 2012 R2 I got this sample from the MSDN site on DateTime. Modified to check the leading Zero of day. public class Sample { public static void Main() { string msg1 = "The date and time patterns are defined in the

CultureInfo is not consistent between windows versions

笑着哭i 提交于 2020-01-23 13:28:05
问题 Has anyone noticed that on different versions of Windows the CultureInfo format will result in a different pattern? Windows 7 created dddd, MMMM dd, YYYY Sample output: Windows 7 Both Windows 10 & Windows Server 2012 created dddd, MMMM d, YYYY Sample output: Windows 10 & Server 2012 R2 I got this sample from the MSDN site on DateTime. Modified to check the leading Zero of day. public class Sample { public static void Main() { string msg1 = "The date and time patterns are defined in the

Compact Framework - Retrieve a list of countries and regions

白昼怎懂夜的黑 提交于 2020-01-23 09:44:30
问题 Afternoon people! I'm trying to implement a list of counties on my Compact Framework (Mobile) application. I can do this easily in the full .Net framework with CultureInfo.GetCultures(..etc). However, the CF seems to be missing this feature? Is there any way I can return a list of countries (and regions if possible) that I can populate into a ComboBox? The OS has a list of countries, so there must be a way to do it? I look forward to hearing back! 回答1: How about this? using System; using

changing cultureinfo on android using xamarin and c#

痞子三分冷 提交于 2020-01-23 03:28:08
问题 Im calling a custom method to dynamically switch the current cultureinfo to french "fr" Like this but after calling that method my android app still use the default culture which is 'en' but in debug mode the culture seems to be ok. My folder are ok. I have both and the string values are configured. folder: resource/values/strings.xml, resource/values-fr/strings.xml. Do I need to reload my contentview or something? what do I miss here? private void SetLocal(string lang) { System.Threading

Localize dataannotation error messages as per culture

谁说胖子不能爱 提交于 2020-01-22 02:30:17
问题 In my WPF appliation, I have property defined as following [Required(AllowEmptyStrings =false, ErrorMessageResourceName ="Msg1", ErrorMessageResourceType =typeof(*<AssemblyName>*.Resources.*<ResourceFileName>*))] public string Name { get { return _name; } set { if (_name == value) { return; } _name = value; } } I have my error messages defined in separate assembly which has resource file for different cultures e.g. Resources.resx, Resources.en-GB.Resx, Resources.fr-FR.Resx, Resources.en-US

Set culture for a WPF DateTimePicker validation

不想你离开。 提交于 2020-01-14 10:36:09
问题 I use a DateTimePicker on a WPF application. I would like to bind the .Text property to the SelectedDate, so I use binding like this: <DatePicker x:Name="DateTimePicker_Date" Text="{Binding dDate, Mode=TwoWay, UpdateSourceTrigger=PropertyChanged, TargetNullValue='', ValidatesOnDataErrors=True}" TabIndex="3" Grid.Column="1" /> My problem is I use an European culture, so: DAY/MONTH/YEAR instead of MONTH/DAY/YEAR, so if I input : 14/02/2013 , I have a validation error ! How can I solve this? 回答1

Change culture when deserializing WCF service

ⅰ亾dé卋堺 提交于 2020-01-13 06:43:09
问题 I'm using C# to read data from a Java-webservice. I've created a Service reference in VS2008 to the server, and can call the one method that is there. However, a few of the fields returned are of type Decimal, and as the automatically generated WCF proxy gets XML back it fails with a CommunicationException saying: "Error in deserializing body of reply message for operation 'getOpenReceivables'." "There is an error in XML document (1, 941)." "Input string was not in a correct format." [Edit]