WPF DataGrid ItemsSource 绑定时的元素修改
xml 片段:
<DataGrid Grid.Row="1" Height="400" Margin="3" ItemsSource="{Binding RecipeTable}" SelectedIndex="{Binding sRow}" AutoGenerateColumns="False" CanUserAddRows="False" AlternationCount="2" RowStyle="{StaticResource DataGridRowStyle}">
ViewModel 片段:
foreach (var item in RecipeTable) { item.RecipeTableColumn0 = tableID.ToString(); tableID++; Console.WriteLine(item.RecipeTableColumn0.ToString()); }

浙公网安备 33010602011771号