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

@ -1,4 +1,5 @@
using Billing.Themes;
using System;
using Xamarin.Forms;
namespace Billing.UI
@ -269,19 +270,34 @@ namespace Billing.UI
set => SetValue(PlaceholderProperty, value);
}
protected override View Content => new OptionEntry
public event EventHandler<FocusEventArgs> Unfocused;
protected override View Content
{
HorizontalOptions = LayoutOptions.Fill,
HorizontalTextAlignment = TextAlignment.End,
VerticalOptions = LayoutOptions.Center,
ReturnType = ReturnType.Next
get
{
var content = new OptionEntry
{
HorizontalOptions = LayoutOptions.Fill,
HorizontalTextAlignment = TextAlignment.End,
VerticalOptions = LayoutOptions.Center,
ReturnType = ReturnType.Next
}
.Binding(Entry.TextProperty, nameof(Text), BindingMode.TwoWay)
.Binding(InputView.KeyboardProperty, nameof(Keyboard))
.Binding(Entry.PlaceholderProperty, nameof(Placeholder))
.DynamicResource(Entry.TextColorProperty, BaseTheme.TextColor)
.DynamicResource(Entry.PlaceholderColorProperty, BaseTheme.SecondaryTextColor)
.DynamicResource(VisualElement.BackgroundColorProperty, BaseTheme.OptionTintColor);
content.Unfocused += Content_Unfocused;
return content;
}
}
private void Content_Unfocused(object sender, FocusEventArgs e)
{
Unfocused?.Invoke(sender, e);
}
.Binding(Entry.TextProperty, nameof(Text), BindingMode.TwoWay)
.Binding(InputView.KeyboardProperty, nameof(Keyboard))
.Binding(Entry.PlaceholderProperty, nameof(Placeholder))
.DynamicResource(Entry.TextColorProperty, BaseTheme.TextColor)
.DynamicResource(Entry.PlaceholderColorProperty, BaseTheme.SecondaryTextColor)
.DynamicResource(VisualElement.BackgroundColorProperty, BaseTheme.OptionTintColor);
}
public class OptionEditorCell : OptionVerticalCell