我目前正在研究wpf項目,其中我必須顯示更新客戶的日期。所以,我有webservice方法來更新整個客戶的信息,但日期不變。我認爲可能有字符串格式的問題,但我已經嘗試了一切。請幫忙! 謝謝!如何在wpf中更新日期
這裏是日期選擇
<Label Grid.Column="9" Grid.Row="1" VerticalAlignment="Top">
<DatePicker
x:Name="newtally"
Text="{Binding CustomerLastTally}"
Margin="0 0 0 0"
SelectedDateChanged="newtallydate"
/>
</Label>
& XAML代碼在這裏是C#
private void newtallydate(object sender, SelectionChangedEventArgs e)
{
webHandler.POS_Update_CustomerAsync(
int.Parse(selected.Customerid),
selected.CustomerName,
Decimal.Parse(selected.Customerbalance),
selected.CustomerLocation,
selected.CustomerLastTally,
(selected.Customerphone),
(selected.Customeraddress));
}
您沒有使用任何方式或綁定到文本(CustomerLastTally)的值選定的日期,我認爲你需要提供更多的代碼並告訴我們你預期會發生什麼。推測你打算將CustomerLastTally綁定到selected.CustomerLastTally?父數據上下文是什麼? –
嘗試綁定到DatePicker的'SelectedDate'屬性而不是'Text':'SelectedDate =「{Binding CustomerLastTally}」' –