Jump to content

Silverlight Datagrid Bug ?


wmismail

Recommended Posts

Silverlight DataGrid Bug ?

Silverlight DataGrid ile ilgili bir çalışma yaparken çok ilginç bir hatayla karşılaştım. DataGrid'de görüntülemek için bir Class oluşturdum. Oluşturduğum Class'ın erişim belirleyicisini yazmadım(varsayılan olarak internal işaretlendi.) Bir List oluşturup içerisine Oluşturduğum nesnenin örneklerini attım. Son olarak da DataGrid'in ItemsSource özelliğine List'i set ettim.

Uygulamayı çalıştırdığım da hata verdi oysa ki hata vermesini gerektirecek bir hata yok. List'deki nesneleri test etmek için bir döngü ile tek tek aldım sorun yok. Sonradan Class'ın erişim belirleyicini public yaptım ve DataGrid'de veriler sorunsuz bir şekilde listelendi. BUG demek doğru olurmu bilmiyorum ama aynı assembly içerisindeki Class'ın public olma zorunluluğu çok gereksiz geldi bana .

namespace DataGridBug
{

public partial class Page : UserControl
{
public Page()
{
InitializeComponent();
this.Loaded += new RoutedEventHandler(Page_Loaded);
}
void Page_Loaded(object sender, RoutedEventArgs e)
{
List<Haber> haberler = new List<Haber>()
{
new Haber()
{
HaberID=1,
Baslik="Silverlight 2.0 ile İnteraktif Uygulamalar",
Tarih= new DateTime(2009,01,10),
YayinDurumu = true
},
new Haber()
{
HaberID=2,
Baslik="semgoksu.com Yenilendi !",
Tarih= new DateTime(2009,01,10),
YayinDurumu = true
},
new Haber()
{
HaberID=3,
Baslik="Windows Vista 7 Release oldu !",
Tarih= new DateTime(2009,01,10),
YayinDurumu = false
},
new Haber()
{
HaberID=4,
Baslik="Visual Studio 2010 Release oldu !",
Tarih= new DateTime(2009,01,10),
YayinDurumu = false
}
};
grid.ItemsSource = haberler;
}
}
? class Haber
{
public int HaberID { get; set; }
public string Baslik { get; set; }
public DateTime Tarih { get; set; }
public bool YayinDurumu { get; set; }
}
}[/CODE]

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...