在DataGrid上我有列:Last counter,Current counter,Current kilos。我想要的是输入列的数据:Last counter,Current counter和Current kilos列将通过减去当前计数器得到它的数据来自(最后一个柜台)。我想直接在DataGrid上这样做。 有没有办法将列绑定到其他列以执行我在Xaml中要求的操作?
这是DataGrid的Xaml代码
<Grid>
<DataGrid FrozenColumnCount="1" Name="grid1" AutoGenerateColumns="False" AlternationCount="2" ItemsSource="{Binding}" Height="auto" Width="auto" Margin="0,163,0,10"
MinRowHeight="26" FontSize="18" Foreground="Black" Background="LightBlue" >
<DataGrid.Columns>
<DataGridTextColumn Binding="{Binding cfname}" Header="First name"/>
<DataGridTextColumn Binding="{Binding cmname}" Header="Middle name"/>
<DataGridTextColumn Binding="{Binding clname}" Header="Last name"/>
<DataGridTextColumn Binding="{Binding address}" ClipboardContentBinding="{x:Null}" Header="Address"/>
<DataGridTextColumn Binding="{Binding boxnumber}" ClipboardContentBinding="{x:Null}" Header="box number"/>
<DataGridTextColumn Binding="{Binding discount}" ClipboardContentBinding="{x:Null}" Header="Discount"/>
<DataGridTextColumn Binding="{Binding typeofsub}" ClipboardContentBinding="{x:Null}" Header="subscription type"/>
<DataGridTextColumn Binding="{Binding ampere}" ClipboardContentBinding="{x:Null}" Header="subscription"/>
<DataGridTextColumn Binding="{Binding required}" ClipboardContentBinding="{x:Null}" Header="Fee"/>
<DataGridTextColumn Binding="{Binding lastkilos}" ClipboardContentBinding="{x:Null}" Header="Last counter"/>
<DataGridTextColumn ClipboardContentBinding="{x:Null}" Header="current counter"/>
<DataGridCheckBoxColumn ClipboardContentBinding="{x:Null}" Header="current kilos"/>
<DataGridCheckBoxColumn ClipboardContentBinding="{x:Null}" Header="price"/>
<DataGridCheckBoxColumn ClipboardContentBinding="{x:Null}" Header="Total cost"/>
</DataGrid.Columns>
</DataGrid>