public static MultiSelectItemTemplateSelector GetMultiSelectItemTemplateSelector(MultiSelectTemplateDescriptor multiSelectTemplateDescriptor) { return(new MultiSelectItemTemplateSelector { SingleFieldTemplate = new DataTemplate ( () => new Grid { Style = LayoutHelpers.GetStaticStyleResource("MultiSelectItemStyle"), Children = { new StackLayout { Margin = new Thickness(2), Padding = new Thickness(7), Children = { new Label { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, FontAttributes = FontAttributes.Bold }.AddBinding(Label.TextProperty, new Binding(multiSelectTemplateDescriptor.TextField)) } } .AssignDynamicResource(VisualElement.BackgroundColorProperty, "ResultListBackgroundColor") } } ) }); }
private static View GetTextField(string titleBinding, string valueBinding, bool isPassword = false) => new Label { Style = LayoutHelpers.GetStaticStyleResource("DetailFormLabel"), FormattedText = new FormattedString { Spans = { new Span { FontAttributes = FontAttributes.Italic }.AddBinding(Span.TextProperty, new Binding(titleBinding)), new Span { Text = ": " }, isPassword ? new Span { FontAttributes = FontAttributes.Bold, Text = "*****" } : new Span { FontAttributes = FontAttributes.Bold }.AddBinding(Span.TextProperty, new Binding(valueBinding)) } } } .AddBinding(VisualElement.IsVisibleProperty, new Binding(nameof(IFormField.IsVisible)));
static Entry GetEntry() => new Entry() { Style = LayoutHelpers.GetStaticStyleResource("DetailFormEntryStyle") } .AssignDynamicResource(VisualElement.BackgroundColorProperty, "EntryBackgroundColor") .AssignDynamicResource(Entry.TextColorProperty, "PrimaryTextColor") .AddBinding(VisualElement.IsVisibleProperty, new Binding(nameof(IFormField.IsVisible)));