From 30ff03b0a6c62aade8cc2b347f0e316e9709a8ce Mon Sep 17 00:00:00 2001 From: Rui Marinho Date: Thu, 26 Jan 2017 15:33:15 +0000 Subject: MacOS (#650) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * [MacOS] Add SwitchRenderer * [MacOS] Add TimePickerRenderer * [MacOS] Cleanup TimePcikerRender * [MacOS] Add WebViewRenderer * [MacOS] Add Javascript evaluate to webview * [MacOS] Fix build error on WebViewRenderer * [MacOS] Add Base and TextCell renderers * [MacOS] Start on ListViewRenderer * [MacOS] Cleanup * [MacOS] Vertical center text on default NSTextField * [MacOS] Center NSTextField vertically * [MacOS] Add ImageCellRenderer * [MacOS] Add SwitchCellRenderer * [MacOS] Add SwitchCellRenderer * [iOS] Allow to set background color on other CellRenderers * [MacOS] Fix selection mode on ListView * [MacOS] Set background on Entry of entry cell * [MacOS] Fix casting bug on CellRenderer * [MacOS] Other fix on CellRenderer background * [MacOS] Add ViewCellRenderer * [MacOS] Fixes and cleanup on cells * [MacOS] Add NSScrollView so NSTableView can scroll * [MacOS] Add HeaderView to ListView * [MacOS] Cleanup * [Controls] Add Header support to ListView * [MacOS] NSView reuse on NSTableView * [MacOS] Some fix on layour order * [MacOS] Add CarouselPageRenderer * [MacOS] Implement EventTracker on PageRenderer * [MacOS] Cleanup CarouselPageRenderer * [MacOS] Add MasterDetailPage renderer * [MacOS] MDP renderer don't allow drag of splitter * [MacOS] Add TabbedPage renderer * [MacOS] Initial sketch of NavigationPageRenderer * [MacOS] Send disappearing of CurrentPage on Dispose on NavigationPageRenderer * [MacOS] Add Gallery page for Mac * [MacOS] Add MacOSExpressionSearch * [MacOS] Fix ColorExtension * [MacOS] Fix MDP renderer layout * [MacOS] Implement native selection on ListViewRenderer * [MacOS] Deselect a item on NSTableView * [MacOS] Remove previous SplitViewItems * [MacOS] Fix navigationpage height * [MacOS] Add toolbar for NavigationPageRenderer * [MacOS] Don't remove selection for now (crashing) * [MacOS] Refactor page and back button title on NavigationPageRenderer * [MacOS] Fix bug when native navigate back * [MacOS] Hide layer when transition * [MacOS] ListviewRenderer fix BbackgroundColor * [MacOS] Fix background on ScrollViewRenderer * [MacOS] Fix header measure on ListViewRenderer * [MacOS] Add Mac twitter demo * [Controls] Spaces for easy reading * [MacOS] More xaml cleanup * [Core] Add Mac as aTargetPlatform * [MacOS] Add alerts and actionsheets * [MacOS] Add GestureRecognizers * [MacOS] Fix Layout issues when adding children, enable transformations * [MacOS] Fix title on tab item, move to tabbed navigation based on segmented control * [MacOS] Hide toolbar when not needed, this allows to work with tabbed page, cleanup * [MacOS] Add NativeBindings and NativeViewWrapper * [MacOS] Fix AssemblyInfo * [MacOS] FIX NRE on SetBackgroundColor BoxView * [MacOS] Fix NavigationPageRenderer * [MacOS] Fix build * [MacOS] Also update page when it resizes * [MacOS] Add LayoutRenderer for handle items position when the bounds change. * [MacOS] Refactor/Cleanup * [MacOS] Add toolbar items support to NavigationPage * [MacOS] Resize images for TabViewITems * [MacOS] Fix TabbedPage resize issues , allow users to override some features when creating TVI * [MacOS] Fix hide/show Navigation toolbar * [MacOS] Redo CarouselPageRenderer with NSPageController * [MacOS] Add support for Modal pages * [MacOS] Refactor navigation from platform * [Nuget] Add nuget for MacOS * [Nuget]Fix nuspec * [Nuget] Add variables for CI * [Controls] Remove MainMenu from MacOS * [MacOS] Add TableView renderer (no headers yet) * [MacOS] Refactoring, marking extensions as internal * [MacOS] Add group headers for TableViewRenderer * [MacOS] Workaround for updates on listview collection * [MacOS] Handle updates of rows in the ListViewRenderer properly * [MacOS] Fix navigation animation * Fix navigation header issues with modal pages * [MacOS] Fix MDP issues with resizing * [MacOS] Fix general dispose * [MacOS] Add a ViewControllerWrapper for NSSplitView * [MacOS] MDP renderer fix animation * [MacOS] Fix ListView selection bug * [MacOS] Fix rendering MDP Layout inside wrappers * [MacOS] Re write the MainToolbar handler * [MacOS] Don't use Sierra new extensions so we can run in stable channel * [MacOS] Another way to hide the toolbar (smarter i think) * [MacOS] Fix MDP bug and remove debug color * [Controls] Add HanselForms sample * [MacOS] Fix NRE WebviewRenderer * [MacOS] Fix uneven rows on ListView renderer * [MacOS] Fix NRE on load (can+t find the reason this happens) * [MacOS] Fix uneven rows * [MacOS] Fix header sizing on ListViewRenderer * [Controls] More stuff on HanselForms * [MacOS] Remove warning from ListViewRenderer * [MacOS] Fix PageRenderer bug double init * [MacOS] Don't calculate height if RowHeight is provided * [Controls] More Hanselforms stuff * [MacOS] Once again a new implementation for the NavigationBar, this time using a custom view to support BackgroundColor * [MacOS] Fix build * [MacOS] Refactoring AwesomeBar related controls * Fix build * [MacOS] NavigationBar update background and t test colors * [MacOS] Fix when we remove navigation so it works when the NavigationRenderer wasn't removed from the parent controller like in a TabbedPage * [MacOS] Add support for ListView grouping * [MacOS] Fix image extension method. * [MacOS] Add base Maps project * [MacOS] Export MapRenderer * [MacOS] Add pin click and geocoderbacked for Maps * [MacOS] Add extra binding project for API not in stable. * [MacOS] Add MacOS Maps lib * [MacOS]Fix build on alpha * [MacOS] Remove MacOS Maps extra binding * [UITest] Basic macOS setup * [UITest] Add MacOSApp wrapper implementation * [MacOS] Set AutomationID * [UITests] Add ActionSheetUITests to MacOS UITest * [MacOS] Fix bug on Picker * [UITests] Link basic uitest basefixture and related files * [MacOS] Fix pickers reuse * [UItests] Fix MacOS app path * [UITest] Ignore UItest for appearing on macOS for now * [UITest] Update macOS for 2.0.3 * [UITest] Refactor EnterText MacOS app * [UITest]Fix ViewQuery on MacOS * [UITest]Fix IsEnabled UItest on macOS * [UITest] Implement Enter, mark some tests inconclusive fix others * [MacOS] Implement Entry Completed event * [UITests] Fix UITest for IsVisible, ignore ToolbarItem test for now * [UITests] Fix ISVisible again add extra category * [Controls] Cleanup macOS gallery * [MacOS] Fix Assembly info * [Docs] Fix docs * Fix build * [Nuget] Fix nuspec * [Controls] Link files on MacOS * [Core] Update Forms stack before firing a event saying page was removed, possible breaking change * [MacOS] Implement RemovePage on NavigationPAgeRenderer * [UItest] Ignore some , implement back on MacOS UITest app * [MacOS] Add default back button name (needs to be translated) * [MacOS] Fix dispose * [UITest] Make 29257 work on MacOS * [MacOS] Rename stuff * [MacOS] More renaming and cleanup * [MacOS] Share implementations for iOS * [MacOS] Reuse more IOS extensions * [MacOS] Reuse FontExtensions * [MacOS] Share NativeViewWrapper related stuff * [MAcOS] Share event args and ExportRenderer * [MacOS] Share platform effect * [MacOS] Fix build * [Docs]Fixing docs * [MacOS] Fix ViewCell reuse * [Core] Support ListView CachingStrategy on MacOS * [MacOS] Fix issues with TextCell and ImageCell (we can’t set null to a NSControl value) * [MacOS] Fix MDP child sizing bug [UITest] Query marked by id and text * [MacOS] Comment test related with context actions * [MacOS] Implement missing stuff on ticker * [MacOS] Make sure VisualElemenTracker calls the ticker update * [UITests]Ignore context actions and not possible to test * [MacOS] Fix Grouping bug on Listview * [MacOS] Fix selection on Listview when using grouping * [MacOS] Update navbar when page is popped * [MacOS] Cleanup NavigationBar * [Controls] More info on exceptions * [MacOS] Fix bug animation pop modal * [MacOS] Bring back BackgroundColor of NavigationBar * [MacOS] Fix UITest animation delay * [MacOS] Treat warnings as errors * [MacOS] Center title on toolbar * [Core] Add Platform configuration specific for MacOS * [MacOS] Implement TabbedPage platform specific to handle TabItems on NavigationPage bar * [MacOS] Fix warning * [MacOS] Fix bug on SearchBar color * [MacOS]Fix build * [MacOS] remove extra dll from maps * [Docs] Update docs * [MacOS]Cleanup and refactoring * Revert "[MacOS] remove extra dll from maps" This reverts commit 73b948937001fea3f28449a963d0b94943e07aa0. * [MacOS] Fix wrong refactoring * [MacOS] Remove gallery and uitest project * [MacOS] dix formatting * [MacOS] Remove extra stuff * Merge branch 'master' into macOS-gallery * [MacOS] Fix rebase * [MacOS] Fix TargetPlatform * fix docs * [MacOS] Fix bug on TabbedPageRenderer no title * [MacOS] Remove FormsNSView * [MacOS] Cleanup on dispose on MDP renderer * [MacOS] Update current page when source changes * [MacOS] More cleanup * [MacOS] Make sure we show the previous page when popping a Modal * [MacOS] Fix issue with sizing the Header and visibility, remove for now header renderer reuse * [MacOS] Clean CustomNSTableView * [MacOS] Share LabelRenderer with iOS * [MacOS] Share ResourcesProvider with iOS * [MAcoS] Share VisualElementPackager with iOS * [MacOS] Share ViewRenderer with iOS * [MacOS] Merge with VisualElementTracker from iOS * [MacOS] Merge with EventTracker from iOS * [MacOS] Merge with VisualElementRenderer of iOS * [MacOS] Make sure we always have a layer * [MacOS] Fix Tracker merge with iOS version * [MacOS] Fix bug with tabbed page on modal without navigation * [Core] Rever change on core * [MacOS] Clear renderers before setting them MDP * [MacOS] Update tabbedPage ContainerArea * [MacOS] Fix ListViewRenderer * [MacOS] Make sure we don’t pass null to TextField string value * [MacOS] Support for multiple clicks in same selected item on NSTableView * [MacOS] Support Focus on EntryRenderer * [MacOS] Fix index bug on TablevIewDataSource * [MacOS] Fix SelectedItem TableViewDataSource * [Nuget] Add Mac to Maps nuspec * [Nuget]Fix path * [macOS] Fixed Tab NSImage crash in TabbedPageRenderer (#705) * [macOS] Fixed Tab NSImage crash in TabbedPageRenderer * Coding Style * Coding Style * [MacOS] Fix previous merge with master * [MacOS] Possible simple fix for click on views overlapping * [MacOS] Rename to IsOnViewCell * [MacOS] Cleanup, Address feedback from Samantha’s review --- .../GalleryPages/MacOSTestGallery.cs | 401 +++++++++++++++++++++ 1 file changed, 401 insertions(+) create mode 100644 Xamarin.Forms.Controls/GalleryPages/MacOSTestGallery.cs (limited to 'Xamarin.Forms.Controls') diff --git a/Xamarin.Forms.Controls/GalleryPages/MacOSTestGallery.cs b/Xamarin.Forms.Controls/GalleryPages/MacOSTestGallery.cs new file mode 100644 index 00000000..3b44683f --- /dev/null +++ b/Xamarin.Forms.Controls/GalleryPages/MacOSTestGallery.cs @@ -0,0 +1,401 @@ +using System; +using System.Collections.Generic; + +namespace Xamarin.Forms.Controls +{ + public class MacOSTestGallery : ContentPage + { + public MacOSTestGallery() + { + mainDemoStack.Children.Add(MakeNewStackLayout()); + var items = new List(); + for (int i = 0; i < 5000; i++) + { + items.Add(new MyItem1 { Reference = "Hello this is a big text " + i.ToString(), ShowButton = i % 2 == 0, Image = "bank.png" }); + } + + var header = new Label { Text = "HELLO HEADER ", FontSize = 40, BackgroundColor = Color.Pink }; + var lst4 = new ListView { Header = header, ItemTemplate = new DataTemplate(typeof(DemoViewCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; + + var lst = new ListView { ItemTemplate = new DataTemplate(typeof(DemoEntryCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; + var lst1 = new ListView { ItemTemplate = new DataTemplate(typeof(DemoTextCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; + var lst2 = new ListView { ItemTemplate = new DataTemplate(typeof(DemoSwitchCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; + var lst3 = new ListView { ItemTemplate = new DataTemplate(typeof(DemoImageCell)), BackgroundColor = Color.Yellow, HeightRequest = 300, RowHeight = 50, ItemsSource = items, }; + + var bigbUtton = new Button { WidthRequest = 200, HeightRequest = 300, Image = "bank.png" }; + + var picker = new DatePicker(); + + var timePicker = new TimePicker { Format = "T", Time = TimeSpan.FromHours(2) }; + + var editor = new Editor { Text = "Edit this text on editor", HeightRequest = 100, TextColor = Color.Yellow, BackgroundColor = Color.Gray }; + + var entry = new Entry { Placeholder = "Edit this text on entry", PlaceholderColor = Color.Pink, TextColor = Color.Yellow, BackgroundColor = Color.Green }; + + var frame = new Frame { HasShadow = true, BackgroundColor = Color.Maroon, OutlineColor = Color.Lime, MinimumHeightRequest = 100 }; + + + var image = new Image { HeightRequest = 100, Source = "crimson.jpg" }; + + var picker1 = new Picker { Title = "Select a team player", TextColor = Color.Pink, BackgroundColor = Color.Silver }; + picker1.Items.Add("Rui"); + picker1.Items.Add("Jason"); + picker1.Items.Add("Ez"); + picker1.Items.Add("Stephane"); + picker1.Items.Add("Samantha"); + picker1.Items.Add("Paul"); + + picker1.SelectedIndex = 1; + + var progress = new ProgressBar { BackgroundColor = Color.Purple, Progress = 0.5, HeightRequest = 50 }; + + picker1.SelectedIndexChanged += (sender, e) => + { + entry.Text = $"Selected {picker1.Items[picker1.SelectedIndex]}"; + + progress.Progress += 0.1; + }; + + var searchBar = new SearchBar { BackgroundColor = Color.Olive, TextColor = Color.Maroon, CancelButtonColor = Color.Pink }; + searchBar.Placeholder = "Please search"; + searchBar.PlaceholderColor = Color.Orange; + searchBar.SearchButtonPressed += (sender, e) => + { + searchBar.Text = "Search was pressed"; + }; + + var slider = new Slider { BackgroundColor = Color.Lime, Value = 0.5 }; + + slider.ValueChanged += (sender, e) => + { + editor.Text = $"Slider value changed {slider.Value}"; + }; + + var stepper = new Stepper { BackgroundColor = Color.Yellow, Maximum = 100, Minimum = 0, Value = 10, Increment = 0.5 }; + + stepper.ValueChanged += (sender, e) => + { + editor.Text = $"Stepper value changed {stepper.Value}"; + }; + + var labal = new Label { Text = "This is a Switch" }; + var switchR = new Switch { BackgroundColor = Color.Fuchsia, IsToggled = true }; + switchR.Toggled += (sender, e) => + { + entry.Text = $"switchR is toogle {switchR.IsToggled}"; + }; + var layoutSwitch = new StackLayout { Orientation = StackOrientation.Horizontal, BackgroundColor = Color.Green }; + layoutSwitch.Children.Add(labal); + layoutSwitch.Children.Add(switchR); + + var webView = new WebView { HeightRequest = 200, Source = "http://google.pt" }; + + var mainStck = new StackLayout + { + Spacing = 10, + BackgroundColor = Color.Blue, + VerticalOptions = LayoutOptions.Center, + HorizontalOptions = LayoutOptions.Center, + Children = + { + lst4, + lst, + lst1, + lst2, + lst3, + webView, + layoutSwitch, + stepper, + slider, + searchBar, + progress, + picker1, + image, + frame, + entry, + editor, + picker, + timePicker, + bigbUtton, + new Button { Text = "Click Me", BackgroundColor = Color.Gray }, + new Button { Image = "bank.png", BackgroundColor = Color.Gray }, + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Left, 10)), + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Top, 10)), + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Bottom, 10)), + CreateButton(new Button.ButtonContentLayout(Button.ButtonContentLayout.ImagePosition.Right, 10)), + mainDemoStack + } + }; + var lbl = new Label { Text = "Second label", TextColor = Color.White, VerticalTextAlignment = TextAlignment.Start, HorizontalTextAlignment = TextAlignment.Center }; + mainStck.Children.Add(new Label { Text = "HELLO XAMARIN FORMS MAC", TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center }); + mainStck.Children.Add(lbl); + mainStck.Children.Add(new BoxView { Color = Color.Pink, HeightRequest = 200 }); + + var scroller = new ScrollView { BackgroundColor = Color.Yellow, HorizontalOptions = LayoutOptions.Center }; + + scroller.Scrolled += (sender, e) => + { + lbl.Text = $"Current postion {scroller.ScrollY}"; + }; + + scroller.Content = mainStck; + + var actv = new ActivityIndicator { BackgroundColor = Color.White, Color = Color.Fuchsia, IsRunning = true }; + mainStck.Children.Add(actv); + + bigbUtton.Clicked += async (sender, e) => + { + await scroller.ScrollToAsync(actv, ScrollToPosition.Center, true); + actv.Color = Color.Default; + }; + + Content = scroller; + } + + public static ContentPage MacDemoContentPage() + { + return new MacOSTestGallery(); + } + + public static NavigationPage MacDemoNavigationPage() + { + var np = new NavigationPage(GetNewPage()) { BarTextColor = Color.Red, BarBackgroundColor = Color.Yellow }; + + np.Pushed += (sender, e) => System.Diagnostics.Debug.WriteLine("Pushed + " + np.CurrentPage.Title); + + np.Popped += (sender, e) => System.Diagnostics.Debug.WriteLine("Popped"); + + np.PoppedToRoot += (sender, e) => System.Diagnostics.Debug.WriteLine("Popped to root"); + + return np; + } + + public static TabbedPage MacDemoTabbedPage() + { + + var btnGo = new Button { Text = "Change Title" }; + var btnGo1 = new Button { Text = "Change Icon" }; + + var lyout = new StackLayout(); + lyout.Children.Add(btnGo); + //lyout.Children.Add(btnGo1); + + var tp = new TabbedPage { BarTextColor = Color.Red, BarBackgroundColor = Color.Yellow }; + + var master = new ContentPage { Icon = "bank.png", BackgroundColor = Color.Red, Title = "Master", Content = lyout }; + + var detail = new ContentPage { Icon = "bank.png", BackgroundColor = Color.Blue, Title = "Detail", Content = new Label { Text = "This is Detail Page" } }; + + tp.Children.Add(master); + tp.Children.Add(detail); + + tp.CurrentPage = detail; + + tp.CurrentPageChanged += (sender, e) => + { + System.Diagnostics.Debug.WriteLine(tp.CurrentPage.Title); + }; + + btnGo.Clicked += (sender, e) => + { + tp.CurrentPage.Title = "Tile changed"; + tp.CurrentPage.Icon = null; + }; + + btnGo1.Clicked += (sender, e) => + { + + }; + return tp; + } + + public static MasterDetailPage MacDemoMasterDetailPage() + { + var mdp = new MasterDetailPage(); + + var master = new ContentPage { BackgroundColor = Color.Red, Title = "Master", Content = new Label { Text = "This is Master Page" } }; + + var detail = new ContentPage { BackgroundColor = Color.Blue, Title = "Detail", Content = new Label { Text = "This is Detail Page" } }; + + mdp.Master = master; + mdp.Detail = detail; + + return mdp; + } + + public static CarouselPage MacDemoCarouselPage() + { + + var carouselPage = new CarouselPage { BackgroundColor = Color.Yellow }; + + var btnGo = new Button { Text = "Goto To Page 1 " }; + var btnGo1 = new Button { Text = "Goto To Page 3 " }; + var stck = new StackLayout(); + stck.Children.Add(btnGo); + stck.Children.Add(btnGo1); + var page = new ContentPage { Title = "Page1", BackgroundColor = Color.Red, Content = new Label { Text = "Page 1 label", TextColor = Color.White, VerticalTextAlignment = TextAlignment.Start, HorizontalTextAlignment = TextAlignment.Center } }; + var page2 = new ContentPage { Title = "Page2", BackgroundColor = Color.Blue, Content = stck }; + var page3 = new ContentPage { Title = "Page3", BackgroundColor = Color.Green, Content = new Label { Text = "Page 3 label" } }; + + carouselPage.Children.Add(page); + carouselPage.Children.Add(page2); + carouselPage.Children.Add(page3); + + carouselPage.CurrentPage = page2; + + btnGo.Clicked += (sender, e) => + { + carouselPage.CurrentPage = page; + }; + + btnGo1.Clicked += (sender, e) => + { + carouselPage.CurrentPage = page3; + }; + + carouselPage.CurrentPageChanged += (sender, e) => + { + System.Diagnostics.Debug.WriteLine(carouselPage.CurrentPage.Title); + }; + return carouselPage; + } + + static int _pageID; + + static StackLayout mainDemoStack = new StackLayout { BackgroundColor = Color.Blue }; + + static ContentPage GetNewPage() + { + var label = new Label { Text = $"Page {_pageID}" }; + var btnGo = new Button { Text = "Push Page" }; + var btnGo1 = new Button { Text = "Pop Page" }; + var lyout = new StackLayout(); + lyout.Children.Add(label); + lyout.Children.Add(btnGo); + lyout.Children.Add(btnGo1); + + btnGo.Clicked += async (sender, e) => + { + _pageID++; + await (lyout.Parent as Page).Navigation?.PushAsync(GetNewPage()); + + }; + + btnGo1.Clicked += async (sender, e) => + { + _pageID--; + await (lyout.Parent as Page).Navigation?.PopAsync(); + + }; + + return new ContentPage { Icon = "bank.png", BackgroundColor = _pageID % 2 == 0 ? Color.Blue : Color.Green, Title = label.Text, Content = lyout }; + } + + static StackLayout MakeNewStackLayout() + { + var count = 0; + var stacklayout = new StackLayout { BackgroundColor = Color.Red }; + + stacklayout.Children.Add(new Label { Text = $"HEllO {count}" }); + stacklayout.Children.Add(new Button + { + Text = "Change layout", + Command = new Command(() => + { + count += 2; + stacklayout.Children.RemoveAt(2); + + var ll = new StackLayout(); + ll.Children.Add(new Label { Text = $"HEllO {count}" }); + ll.Children.Add(new Label { Text = $"HEllO {count + 1}" }); + stacklayout.Children.Add(ll); + }) + }); + stacklayout.Children.Add(new Label { Text = $"HEllO {count + 1}" }); + count += 2; + return stacklayout; + } + + + + static Button CreateButton(Button.ButtonContentLayout layout) + { + return new Button + { + Text = "Click Me On Mac", + Image = "bank.png", + Font = Font.OfSize("Helvetica", 14), + ContentLayout = layout, + BackgroundColor = Color.Black, + TextColor = Color.White + }; + } + + class DemoSwitchCell : SwitchCell + { + public DemoSwitchCell() + { + SetBinding(TextProperty, new Binding("Reference")); + SetBinding(OnProperty, new Binding("ShowButton")); + } + } + + class DemoImageCell : ImageCell + { + public DemoImageCell() + { + SetBinding(TextProperty, new Binding("Reference")); + SetBinding(DetailProperty, new Binding("ShowButton")); + SetBinding(ImageSourceProperty, new Binding("Image")); + } + } + + class DemoTextCell : TextCell + { + public DemoTextCell() + { + SetBinding(TextProperty, new Binding("Reference")); + SetBinding(DetailProperty, new Binding("ShowButton")); + } + } + + class DemoEntryCell : EntryCell + { + public DemoEntryCell() + { + SetBinding(LabelProperty, new Binding("Reference")); + SetBinding(TextProperty, new Binding("ShowButton")); + LabelColor = Color.Red; + Placeholder = "This is a entry cell"; + } + } + + class DemoViewCell : ViewCell + { + public DemoViewCell() + { + var box = new Image { BackgroundColor = Color.Pink, WidthRequest = 100, HeightRequest = 40, Source = "bank.png" }; + var label = new Label { TextColor = Color.White }; + var labelDetail = new Label { TextColor = Color.White }; + + label.SetBinding(Label.TextProperty, new Binding("Reference")); + labelDetail.SetBinding(Label.TextProperty, new Binding("ShowButton")); + + var grid = new Grid { BackgroundColor = Color.Black }; + + grid.Children.Add(box, 0, 1, 0, 1); + grid.Children.Add(label, 1, 0); + grid.Children.Add(labelDetail, 1, 1); + + View = grid; + } + } + + public class MyItem1 + { + public string Reference { get; set; } + public string Image { get; set; } + public bool ShowButton { get; set; } + } + } +} -- cgit v1.2.3