balance binding

This commit is contained in:
2022-02-26 17:29:12 +08:00
parent 4d69bea70b
commit 283acf7d35
6 changed files with 59 additions and 32 deletions

View File

@ -39,8 +39,9 @@
<OnPlatform x:TypeArguments="x:String" Android=" "/>
</TableSection.Title>
<ui:OptionEntryCell Title="{r:Text Balance}" Height="44" Icon="sackdollar.png"
Text="{Binding Balance, Mode=TwoWay, Converter={StaticResource moneyConverter}}"
Keyboard="Numeric" Placeholder="{r:Text BalancePlaceholder}"/>
Text="{Binding Balance, Converter={StaticResource moneyConverter}}"
Keyboard="Numeric" Placeholder="{r:Text BalancePlaceholder}"
Unfocused="Balance_Unfocused"/>
<ui:OptionTextCell Title="{r:Text Currency}" Height="44" Icon="dollar.png"
Detail="{r:Text CNY}"/>
</TableSection>

View File

@ -69,6 +69,16 @@ namespace Billing.Views
InitializeComponent();
}
private void Balance_Unfocused(object sender, FocusEventArgs e)
{
if (sender is OptionEntry entry && decimal.TryParse(entry.Text, out decimal d))
{
var converter = (MoneyConverter)Resources["moneyConverter"];
entry.Text = converter.Convert(d, null, null, null)?.ToString();
//Balance = d;
}
}
private async void OnCheckAccount()
{
if (Tap.IsBusy)