我在Silverlight項目中有一個特殊查找窗口,它綁定到一個特價表。我在該表中有產品代碼和價格。我想顯示數據網格中每個代碼的產品名稱。與代碼對應的產品名稱位於另一個名為products的表中。我嘗試使用IValueConverter。由於Linq查詢是異步執行的,我無法返回該值
string ProductName = "";
public object Convert(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
string ProdCode = value.ToString();
var GetProdNamesQuery = GV.dbContext.Load(GV.dbContext.GetProdNamesQuery(ProdCode));
GetProdNamesQuery.Completed += new EventHandler(GetProdNamesQuery_Completed);
return ProductName;
}
void GetProdNamesQuery_Completed(object sender, EventArgs e)
{
}
public object ConvertBack(object value, Type targetType, object parameter, System.Globalization.CultureInfo culture)
{
throw new NotImplementedException();
}
任何其他方式我可以解決這個問題?