作者sunny10463 ( )
看板C_Sharp
标题[问题] Android Xamarin DataGrid update
时间Thu Jun 10 18:53:29 2021
最近在写xamarin遇到个问题
图一:
https://imgur.com/4vILlbA.jpg
图二:
https://imgur.com/PIErXTB.jpg
E = (B-C)*D
图一为一开始以MVVM架构载入,会自动计算栏位E
但是图二,修改栏位D(或C)栏位时,不会自动计算栏位E
请问各位高手该用何事件?
程式码:
<ContentPage xmlns="
http://xamarin.com/schemas/2014/forms"
xmlns:x="
http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:dg="clr-namespace:Xamarin.Forms.DataGrid;assembly=Xamarin.Forms.DataGrid">
<dg:DataGrid.Columns>
<dg:DataGridColumn Title="A" PropertyName="A" Width="1*"/>
<dg:DataGridColumn Title="B" PropertyName="B" Width="1*"/>
<dg:DataGridColumn Title="C" PropertyName="C" Width="1*" >
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding .}" Keyboard="Numeric" />
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="D" PropertyName="D" Width="1*">
<dg:DataGridColumn.CellTemplate>
<DataTemplate>
<Entry Text="{Binding .}" Keyboard="Numeric"
Completed="Entry_Completed"/>
</DataTemplate>
</dg:DataGridColumn.CellTemplate>
</dg:DataGridColumn>
<dg:DataGridColumn Title="E" PropertyName="E"
BindingContext="{Binding E}" Width="1*"/>
</dg:DataGrid.Columns>
</ContentPage>
谢谢
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 180.217.192.47 (台湾)
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/C_Sharp/M.1623322411.A.05B.html