Hello all I new in silverlight And i found one strange thing..
when i tried to bind List of object to datagrid all works fine. Values shows fine... But, when i try to use linq to select only one value. Datagrid return blanks rows..
but what is strange. where i try to get value of selected row it gives me right value...
here is code
can anybody tell me where is problem ?
when i tried to bind List of object to datagrid all works fine. Values shows fine... But, when i try to use linq to select only one value. Datagrid return blanks rows..
but what is strange. where i try to get value of selected row it gives me right value...
here is code
Code:
private void LayoutRoot_Loaded(object sender, RoutedEventArgs e) { List<test> lTest = new List<test>(); lTest.Add(new test("test", "test2")); lTest.Add(new test("test", "test2")); //dataGrid1.ItemsSource = lTest; this Works dataGrid1.ItemsSource = from t in lTest select new { val1 = t.Value1 }; } } public class test { public test(string Value1, string Value2) { this.Value1 = Value1; this.Value2 = Value2; } public string Value1 { get; set; } public string Value2 { get; set; } }
Comment