public AddStorePage() { InitializeComponent(); ViewModel = new AddStoreViewModel(); BindingContext = ViewModel; foreach (string category in AppConstants.CATEGORIES) { categoryPicker.Items.Add(category); } var tagEntryView = new TagEntryView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, TagValidatorFactory = new Func <string, object>((arg) => ViewModel.ValidateAndReturn(arg)), TagViewFactory = new Func <View>(() => new TagItemView()) }; tagEntryView.SetBinding <AddStoreViewModel>(TagEntryView.TagItemsProperty, v => v.Items); tagEntryView.TagTapped += (sender, e) => { if (e.Item != null) { ViewModel.RemoveTag((TagItem)e.Item); } }; tagEntryWrapper.Children.Add(tagEntryView); }
public TagEntryViewPage() { Title = "TagEntryView Demo"; var tagEntryView = new TagEntryView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, TagValidatorFactory = new Func <string, object>((arg) => ViewModel.ValidateAndReturn(arg)), TagViewFactory = new Func <View>(() => new TagItemView()) }; tagEntryView.SetBinding <TagEntryViewPageModel>(TagEntryView.TagItemsProperty, v => v.Items); tagEntryView.TagTapped += (sender, e) => { if (e.Item != null) { ViewModel.RemoveTag((TagEntryViewPageModel.TagItem)e.Item); } }; Content = new ScrollView() { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = 10, Content = tagEntryView }; }