TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Ahmed Amin Youssef
NA
14
1.4k
WPF datagrid not showing data after binding it to LINQ join query resu
Dec 3 2020 9:44 AM
I have a data grid in WPF that is populated from LINQ join query as follows:
public
IEnumerable<InboxTransaction> GetAllInboxTransactions()
{
try
{
var result =
from s
in
this
.InboxContext.Inboxes
join st
in
this
.InboxContext.Sites
on s.Trans_Site equals st.Site_Code
select
new
InboxTransaction
(
s.Trans_Number,
s.Trans_Date,
s.Trans_Description,
st.Site_Description
);
return
(result);
}
catch
(Exception e)
{
MessageBox.Show(
"??? ??? ???"
);
throw
(e);
}
When I bind the data grid to this result, data grid is not showing any data:
var source = InboxTrans.GetAllInboxTransactions();
InboxGrid.ItemsSource = source;
This is the definition of the data grid:
<DataGrid Name=
"InboxGrid"
AutoGenerateColumns=
"False"
CanUserAddRows=
"False"
CanUserResizeColumns=
"True"
DataContext=
"{Binding}"
FlowDirection=
"RightToLeft"
ItemsSource=
"{Binding}"
Margin=
"5,94,42,218"
Grid.ColumnSpan=
"3"
Grid.Column=
"2"
>
<DataGrid.Columns>
<DataGridTextColumn Binding=
"{Binding Trans_Number}"
Header=
"??? ??????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTextColumn Binding=
"{Binding Trans_Date}"
Header=
"????? ??????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTextColumn Binding=
"{Binding Trans_Description}"
Header=
"???? ??????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTextColumn Binding=
"{Binding Site_Name}"
Header=
"????? ?????? ?????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTemplateColumn>
<DataGrid Name=
"InboxGrid"
AutoGenerateColumns=
"False"
CanUserAddRows=
"False"
CanUserResizeColumns=
"True"
DataContext=
"{Binding}"
FlowDirection=
"RightToLeft"
ItemsSource=
"{Binding}"
Margin=
"5,94,42,218"
Grid.ColumnSpan=
"3"
Grid.Column=
"2"
>
<DataGrid.Columns>
<DataGridTextColumn Binding=
"{Binding Trans_Number}"
Header=
"??? ??????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTextColumn Binding=
"{Binding Trans_Date}"
Header=
"????? ??????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTextColumn Binding=
"{Binding Trans_Description}"
Header=
"???? ??????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTextColumn Binding=
"{Binding Site_Name}"
Header=
"????? ?????? ?????"
IsReadOnly=
"True"
Visibility=
"Visible"
/>
<DataGridTemplateColumn> <DataGridTemplateColumn.CellTemplate>
<DataTemplate>
<Button x:Name=
"btnDelete"
Click=
"btnDelete_Click"
Content=
"???"
/>
</DataTemplate>
</DataGridTemplateColumn.CellTemplate>
</DataGridTemplateColumn>
</DataGrid.Columns>
</DataGrid>
Reply
Answers (
2
)
prismJs not working.
how to pass int array value to querystring in asp.net