I am writing a WPF application that reading data from a excel file, and adding them to a database with LINQ.
I want to use my own UserControl (a complex button with animation that I create with WPF User
Control Library ) in each row of a DataGrid (the DataGrid shows the Database Table). I am using LINQ to add data in database. I have a
problem here. I use the below method in my C# code but the cell involve
this statement instead of showing the UserControl: "APButton.UserControl1" (APButton is my own Button). It's like a string!
var book = new LinqToExcel.ExcelQueryFactory(@"E:\\list.xlsx");
var query = from row in book.Worksheet("Sheet1")
let item = new
{
FullName = row["name"].Cast<string>(),
StNumber = row["stnumber"].Cast<string>(),
Branch = row["branch"].Cast<string>(),
CourseName =
row["coursename"].Cast<string>(),
Status = apButton,
}
select item;
MyDataGrid.ItemsSource = query;