【发布时间】:2013-07-06 16:48:16
【问题描述】:
在我的 wpf 应用程序中,我有一个定义此方法的 MonthView 类,它从日历中获取选定的日期并显示该日期的相应 dayView 窗口。
public void calItemSelectedDate(object sender, SelectionChangedEventArgs e)
{
DateTime d;
if (sender is DateTime)
{
d = (DateTime)sender;
}
else
{
DateTime.TryParse(sender.ToString(), out d);
}
DayView Activity = new DayView(d);
Activity.Show();
this.Hide();
}
现在,在我的 CustomView 类中,我创建了 dayView 的实例,我想在其中传递选定的日期。
DateTime p = Globals._globalController.getMonthViewWindow.calItemSelectedDate(object s, EventArgs e); // here it shows error
DayView d = new DayView(DateTime p);
所以,请建议调用“calItemSelectedDate”方法的方法,以便我可以将适当的日期时间参数传递给我的 DayView。
【问题讨论】:
-
尝试 DateTime p = Globals._globalController.getMonthViewWindow.calItemSelectedDate(this, null);
-
@DatRid 在“this”关键字处仍然显示错误。
标签: c# wpf datetime parameter-passing function-calls