public PublicRoomsPage(ViewModelBase viewModel) : base(viewModel) { var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var textCell = new TextCell(); textCell.SetBinding(TextCell.TextProperty, new Binding("Name")); textCell.TextColor = Styling.BlackText; //textCell.SetBinding(TextCell.DetailProperty, new Binding("Description")); return textCell; }), SeparatorVisibility = SeparatorVisibility.None }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("PublicRooms")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectRoomCommand")); var loadingIndicator = new ActivityIndicator (); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { loadingIndicator, listView } }; }
public ActiveChatsPage(ViewModelBase viewModel) : base(viewModel) { var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell(); imageCell.SetBinding(ImageCell.TextProperty, new Binding("Name")); imageCell.SetBinding(ImageCell.DetailProperty, new Binding("DescriptionText")); imageCell.SetBinding(ImageCell.ImageSourceProperty, new Binding("Image")); imageCell.TextColor = Styling.CellTitleColor; imageCell.DetailColor = Styling.CellDetailColor; return imageCell; }), SeparatorVisibility = SeparatorVisibility.None }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("ActiveChats")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectActiveChatCommand")); listView.SetBinding(ListView.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay)); var noItemsLabel = new Label { Text = "Start a conversation or open a room!", HorizontalOptions = LayoutOptions.Center, FontSize = 16, TextColor = Color.Gray }; var noItemsLayout = new StackLayout { VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { new BoxView{HeightRequest = 20}, noItemsLabel } }; noItemsLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("HasConversations", BindingMode.OneWay, converter: new InverterConverter())); var loadingIndicator = new ActivityIndicator (); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { loadingIndicator, listView, noItemsLayout } }; }
public OnlineUsersPage(ViewModelBase viewModel) : base(viewModel) { var usersCountLabel = new SquawkLabel () { }; usersCountLabel.SetBinding(Label.TextProperty, new Binding("Users.Count", stringFormat: " {0} users online")); var filterEntry = new SquawkEntry () { Placeholder = "Filter...", }; filterEntry.SetBinding (Entry.TextProperty, new Binding ("FilterText")); var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell { ImageSource = Styling.ContactIcon }; imageCell.SetBinding(TextCell.TextProperty, new Binding("Name")); imageCell.SetBinding(TextCell.DetailProperty, new Binding("Description")); imageCell.TextColor = Styling.CellTitleColor; imageCell.DetailColor = Styling.CellDetailColor; return imageCell; }) }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("UsersDisplay")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("SelectUserCommand")); var loadingIndicator = new ActivityIndicator (); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); loadingIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { new StackLayout {Children = { usersCountLabel, filterEntry, loadingIndicator }, BackgroundColor = Styling.SubheaderYellow, Padding = new Thickness(3) }, listView } }; }
public InviteToAppPage(ViewModelBase viewModel) : base(viewModel) { Title = "Contacts"; var contactsCountLabel = new SquawkLabel(); contactsCountLabel.SetBinding(Label.TextProperty, new Binding("Contacts.Count", stringFormat: "{0} contacts.")); var tipLabel = new SquawkLabel(); tipLabel.Text = "Select a contact to send an invitation"; var listView = new BindableListView { ItemTemplate = new DataTemplate(() => { var imageCell = new ImageCell { ImageSource = Device.OnPlatform( ImageSource.FromFile("empty_contact.jpg"), ImageSource.FromFile("empty_contact.jpg"), ImageSource.FromFile("Assets/empty_contact.jpg")), }; imageCell.SetBinding(TextCell.TextProperty, new Binding("Name")); imageCell.SetBinding(TextCell.DetailProperty, new Binding("Number")); return imageCell; }), IsGroupingEnabled = true, GroupDisplayBinding = new Binding("Name"), }; listView.SetBinding(ListView.ItemsSourceProperty, new Binding("GroupedContacts")); listView.SetBinding(BindableListView.ItemClickedCommandProperty, new Binding("ContactSelectedCommand")); var loadingIndicator = new ActivityIndicator(); loadingIndicator.SetBinding(ActivityIndicator.IsRunningProperty, new Binding("IsBusy")); Content = new StackLayout { Children = { loadingIndicator, contactsCountLabel, tipLabel, listView } }; }