【发布时间】:2018-11-13 15:51:42
【问题描述】:
我添加了一个以天为单位的日期和以字母为单位的月份的标签,但我还需要它来显示正确的语言。
我有这个标签:
<Label Text="{Binding Date, StringFormat='{0:dd MMMM}'}"></Label>
我在 ViewModel 中有这个:
public class EventPageViewModel : INotifyPropertyChanged
{
private readonly INavigationService _navigationService;
//public DelegateCommand Date { get; set; }
public EventPageViewModel(INavigationService navigationService)
{
_navigationService = navigationService;
}
DateTime _startdate;
public DateTime Date
{
get
{
return _startdate;
}
set
{
_startdate = value;
RaisePropertyChanged("Date");
}
}
public event PropertyChangedEventHandler PropertyChanged;
protected void RaisePropertyChanged(string propertyName)
{
if (PropertyChanged != null)
{
PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
}
}
}
我已经尝试了很多东西,但我怎么能以某种方式添加这个:
CultureInfo MyCultureInfo = new CultureInfo("se-SE");
也就是说,用我想要的语言代替十月。
非常感谢!!
【问题讨论】:
-
它应该自动使用设备的语言/区域设置
-
试试this 回答。
标签: c# xamarin data-binding xamarin.forms