Reputation: 1463
I have a ListBox
, and it has a Binding
to dtAtt
, but when I run the app, the ListBox show the items with empty content.
Code:
Xaml:
<Expander Name="expandAtt" Header="Attachment">
<ListBox x:Name="lstAtt" MouseDoubleClick="lstAtt_MouseDoubleClick" ItemsSource="{Binding}" DisplayMemberPath="Name">
</ListBox>
</Expander>
C#:
public DataTable dtAtt;
string sql = "SELECT Name FROM Item2Inv_Link";
dtAtt = DataBase.GetTable(sql);
lstAtt.ItemsSource = dtAtt.Select("Att_Pkg=0");
Upvotes: 0
Views: 286
Reputation: 2212
You need to change your your source you're binding in the code just a bit. Try this:
lstAtt.ItemsSource = dtAtt.Select("Att_Pkg=0").CopyToDataTable().DefaultView;
Upvotes: 1