ممنون که وقت گذاشتین و جواب دادین
من اومدم از ObservableCollectionاستفاده کردم ولی لیست ویو رو پر نکرد .این کدشه:
DataTable tbl = TblCountry.Select_tblCountry_All();
ObservableCollection <Countrylist> tblCountry;
tblCountry = new ObservableCollection<Countrylist>();
foreach (DataRow row in tbl.Rows)
{
var obj = new Countrylist()
{
IdCountry = (int)row["fldIdCountry"],
Country = (string)row["fldCountry"],
CountryCode = (string)row["fldCountryCode"],
Currancies = (string)row["fldCurrencies"]
};
tblCountry .Add(obj);
}
lsvCountry.ItemsSource = tblCountry;
public class Countrylist
{
public int IdCountry { get; set; }
public string Country { get; set; }
public string CountryCode { get; set; }
public string Currancies { get; set; }
}
کد xaml listview
<ListView.View>
<GridView>
<GridViewColumn Header="ردیف" Width=" 60" DisplayMemberBinding="{Binding Path=Row}" />
<GridViewColumn Header="کشور" Width=" 100" DisplayMemberBinding="{Binding Path=fldCountry}"/>
<GridViewColumn Header="کد کشور" Width=" 100" DisplayMemberBinding="{Binding Path=fldCountryCode}"/>
<GridViewColumn Header="واحد پول" Width="100" DisplayMemberBinding="{Binding Path=fldCurrencies}"/>
<GridViewColumn Header="fldIdCountry" Width="0" DisplayMemberBinding="{Binding Path=fldIdCountry}"/>
</GridView>
</ListView.View>
میشه بگین اشکال کار کجاست؟