viviano

viviano

  • NA
  • 31
  • 22.3k

linq to datagrid...crazy

Oct 19 2011 10:04 AM
i have 1 table: Via1(via_id int, via_desc varchar(50), via_stato varchr(1))

i have this a datagrid:
<sdk:DataGrid AutoGenerateColumns="False" Height="116" HorizontalAlignment="Left"  Name="dg1" RowDetailsVisibilityMode="VisibleWhenSelected" VerticalAlignment="Top" Width="614">
  <sdk:DataGrid.Columns>
  <sdk:DataGridTextColumn x:Name="via_desc1Column" Binding="{Binding}" Header="Via desc 1" Width="SizeToHeader" />
  <sdk:DataGridTextColumn x:Name="via_id1Column" Binding="{Binding }" Header="Via id 1" IsReadOnly="True" Width="SizeToHeader" />
  <sdk:DataGridTextColumn x:Name="via_statoColumn" Binding="{Binding }" Header="Via stato" Width="SizeToHeader" />
  </sdk:DataGrid.Columns>
  </sdk:DataGrid>
  1 button on form:
 private void button1_Click(object sender, RoutedEventArgs e)
  {
  ctx.Load(ctx.GetVia1Query());

  var v = from t1 in ctx.via1s
  select new { via_desc1 = t1.via_desc1, via_id1=t1.via_id1 };

  dg1.ItemsSource =v.ToList(); 
  }


the result is wrong into datagrid because return name columnand data  (like on attach).


Why????? :((
thanks
V



Attachment: dataform.rar