如何从另一个地方调用这个方法?
private void AssortDatagrid_LoadRows(object sender, Microsoft.Windows.Controls.DataGridRowEventArgs e)
{
if (ValidTill.SelectedIndex >= 0)
{
DataRowView rowContext = e.Row.DataContext as DataRowView;
string item = rowContext.Row["Срок годности"].ToString();
DateTime date;
if ((DateTime.TryParseExact(item, "dd'.'MM'.'yyyy",
CultureInfo.InvariantCulture,
DateTimeStyles.None,
out date)) && (rowContext != null))
{
if (date.Date <= dt.Date)
{
try
{
e.Row.Background = new BrushConverter().ConvertFromString(rowColor) as SolidColorBrush;
}
catch (Exception ex)
{
MessageBox.Show(ex.Message);
return;
}
}
}
else // когда не может парсировать дату
{
}
}
}
我想在这里称呼它:
private void workForce_DoWork(object sender, DoWorkEventArgs e)
{
AssortDatagrid_LoadRows(object sender, Microsoft.Windows.Controls.DataGridRowEventArgs e)
}
可以调用吗?让我解释一下我在做什么。我想在加载行时调用弹出窗口,在弹出窗口中我有圆形进度条作为 gif 动画。我正在更改有效日期很快的那些项目的行背景。