0
提醒日期是美國格式(mm/dd/yyyy)默認情況下,我猜。如何操縱提醒的收集和格式化日期英國格式,以便在列表框中將顯示提示如下:如何在提醒中操作日期格式
開始時間(英國格式或非美國格式)
內容
MyReminders = ScheduledActionService.GetActions()
.Where(a => a.BeginTime.Date == Today);
foreach (Reminder r in MyReminders)
{
// How to change the date format to British in each of the reminder and display
in the listBox?
}
ReminderListBox.ItemsSource = MyReminders;
In the list Box :
<ListBox Name="ReminderListBox" Margin="1,116,-2,4" >
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Background="Transparent" Margin="0,0,0,30">
<StackPanel Orientation="Horizontal" >
<TextBlock Text="begin "/>
<TextBlock Text="{Binding BeginTime}" HorizontalAlignment="Right"/>
</StackPanel>
</Grid>
</DataTemplate/>
</ListBox.ItemTemplate/>
</ListBox />
問題:我不想在列表框中設置日期格式。我想動態檢測語言環境並顯示日期格式基於檢測到的語言環境Ex非美國格式Jpn,Kor,中國
感謝。我剛剛更新了我的問題。我想要的是檢測手機的語言環境,然後根據它顯示日期格式。那麼,如何獲取日期格式。謝謝 – MilkBottle
@MilkBottle:看看編輯是否可以幫助你... –
是的。這是我想要的。問題是(1)如果電話區域設置爲臺灣,ListBox DataTemplate中的{Binding BeginTime,StringFormat = d}將如何顯示?會顯示DD/MM/YYYY嗎? (2)如何將此stringFormat動態傳遞給ListBox DataTemplate?謝謝 – MilkBottle