public MocaCell() { var Codigo = new Label { HorizontalTextAlignment = TextAlignment.End, HorizontalOptions = LayoutOptions.Start, FontSize = 16, FontAttributes = FontAttributes.Bold, }; Codigo.SetBinding(Label.TextProperty, new Binding("Codigo")); var Guerra = new Label { FontSize = 24, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Start, Margin = 5 }; Guerra.SetBinding(Label.TextProperty, new Binding("Guerra")); var Image = new CircleImage { BorderColor = Color.White, BorderThickness = 3, HeightRequest = 60, WidthRequest = 60, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, Source = "Login" }; Image.SetBinding(Label.TextProperty, new Binding("Image")); var line1 = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { Image, Codigo } }; var line2 = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { Guerra } }; View = new StackLayout { Orientation = StackOrientation.Vertical, Children = { line1, line2 } }; }
public SettingsUserView() { BindingContext = profileViewModel = new ProfileViewModel(); profileViewModel.GetCPFeedCommand.Execute(null); var activityIndicator = new ActivityIndicator { Color = Color.Black, }; activityIndicator.SetBinding(IsVisibleProperty, "IsBusy"); activityIndicator.SetBinding(ActivityIndicator.IsRunningProperty, "IsBusy"); var circleImage = new CircleImage { BorderColor = Color.White, BorderThickness = 2, HeightRequest = 80, WidthRequest = 80, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, Source = new UriImageSource { Uri = new Uri("http://bit.ly/1s07h2W"), CacheValidity = TimeSpan.FromDays(15) }, }; var label = new Label() { Text = "Usuario", TextColor = Color.White, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; Content = new StackLayout() { Padding = new Thickness(0, 10, 0, 0), Spacing = 15, Orientation = StackOrientation.Vertical, Children = { circleImage, label, activityIndicator, } }; circleImage.SetBinding(CircleImage.SourceProperty, "Avatar"); label.SetBinding(Label.TextProperty, "DisplayName"); //var tapGestureRecognizer = new TapGestureRecognizer(); //tapGestureRecognizer.Tapped += // (sender, e) => // Navigation.PushModalAsync(new NavigationPage(new Profile(profileViewModel.myProfile)) { BarBackgroundColor = App.BrandColor }); //circleImage.GestureRecognizers.Add(tapGestureRecognizer); }
protected async override void OnAppearing() { base.OnAppearing(); var source = new JsonImageListSource(Resolver.Resolve <IJsonSerializer>()); var items = await source.GetListItems(); var list = new ListView { HasUnevenRows = true, ItemsSource = items, ItemTemplate = new DataTemplate(() => { var image = new CircleImage { Aspect = Aspect.AspectFill, HeightRequest = Device.OnPlatform(50, 75, 75), WidthRequest = Device.OnPlatform(50, 75, 75), }; image.SetBinding(Image.SourceProperty, "Image"); var label = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)), YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; label.SetBinding(Label.TextProperty, "Title"); return(new ViewCell { View = new StackLayout { Padding = new Thickness(20), Spacing = 10, Orientation = StackOrientation.Horizontal, Children = { image, label } } }); }) }; this.Content = new StackLayout { Children = { new Label { Text = Device.OnPlatform( "Works on iOS", "Works on Android now as well", "Works on WP") }, list } }; }
protected async override void OnAppearing() { base.OnAppearing(); var source = new JsonImageListSource(Resolver.Resolve<IJsonSerializer>()); var items = await source.GetListItems(); var list = new ListView { HasUnevenRows = true, ItemsSource = items, ItemTemplate = new DataTemplate(() => { var image = new CircleImage { Aspect = Aspect.AspectFill, HeightRequest = Device.OnPlatform(50, 75, 75), WidthRequest = Device.OnPlatform(50, 75, 75), }; image.SetBinding(Image.SourceProperty, "Image"); var label = new Label { FontSize = Device.GetNamedSize(NamedSize.Medium, typeof (Label)), YAlign = TextAlignment.Center, XAlign = TextAlignment.Center }; label.SetBinding(Label.TextProperty, "Title"); return new ViewCell { View = new StackLayout { Padding = new Thickness(20), Spacing = 10, Orientation = StackOrientation.Horizontal, Children = { image, label } } }; }) }; this.Content = new StackLayout { Children = { new Label { Text = Device.OnPlatform( "Works on iOS", "Works on Android now as well", "Works on WP") }, list } }; }
public EmployeeNameCell() { var EmpImage = new CircleImage() { HorizontalOptions = LayoutOptions.Start, //BorderThickness=5, //Source = "Pics/ 5b571de8-5e8c-4991-9bcb-113348e66d69.jpeg", //BorderColor=Color.White, Aspect = Aspect.Fill, }; EmpImage.SetBinding(Image.SourceProperty, new Binding("EmpProfileImage")); EmpImage.WidthRequest = EmpImage.HeightRequest = 70; var nameLabel = new Label { HorizontalOptions = LayoutOptions.Start, TextColor = Color.White }; nameLabel.FontSize = 15; nameLabel.SetBinding(Label.TextProperty, "FullName"); var Designation = new Label { HorizontalOptions = LayoutOptions.Start, TextColor = Color.White }; Designation.FontSize = 15; Designation.SetBinding(Label.TextProperty, "EmailAddress"); View = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Start, Padding = new Thickness(0, 2.5, 0, 1.5), HeightRequest = 10, Spacing = 0, Children = { EmpImage, //new Image{Source="index.jpg",HeightRequest=50,WidthRequest=50}, new StackLayout { Spacing = 0, Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Start, Padding = 0, Children = { nameLabel, Designation } }, } }; }
public MunCell() { var vetProfileImage = new CircleImage { HeightRequest = 50, WidthRequest = 50, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; vetProfileImage.SetBinding(Image.SourceProperty, "ImageSource"); var nameLabel = new Label() { FontFamily = Definitions.FontFamily, FontSize = Definitions.LoginLabelText, TextColor = Color.FromHex(Definitions.DefaultTextColor), YAlign = TextAlignment.Center, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; nameLabel.SetBinding(Label.TextProperty, "Name"); var vetDetailsLayout = new StackLayout { Padding = new Thickness(15, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { nameLabel } }; var tapImage = new Image() { Source = "Resources/right.png", IsVisible = true, Opacity = 0.4, HorizontalOptions = LayoutOptions.End, }; var cellLayout = new StackLayout { Spacing = 0, Padding = new Thickness(20, 5, 20, 5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { vetProfileImage, vetDetailsLayout, tapImage } }; this.View = cellLayout; }
public TalkDetailPage() { Name.SetBinding(Label.TextProperty, "Speaker.Name"); TwitterHandle.SetBinding(Label.TextProperty, "Speaker.Twitter"); Hero.SetBinding(Image.SourceProperty, nameof(TalkDetailPageModel.ImageSr)); Share.SetBinding(Button.CommandProperty, nameof(TalkDetailPageModel.ShareCommand)); AddedToggle.SetBinding(Button.TextProperty, nameof(TalkDetailPageModel.AddedToggleText)); AddedToggle.SetBinding(Button.CommandProperty, nameof(TalkDetailPageModel.ToggleCommand)); SpeakerInfo.Children.Add(Hero); MainLayout.Children.Add(Hero); var innerLayout = new StackLayout() { Children = { Name, TwitterHandle, Share } }; var lowerLayout = new StackLayout() { Orientation = StackOrientation.Horizontal, Padding = new Thickness(5), Children = { Time, Track } }; MainLayout.Children.Add(innerLayout); MainLayout.Children.Add(lowerLayout); Time.SetBinding(Label.TextProperty, "SelectedTalk.DateAndTime"); TalkTitle.SetBinding(Label.TextProperty, "SelectedTalk.Title"); Track.SetBinding(Label.TextProperty, "SelectedTalk.Track"); var descriptionScroll = new ScrollView(); descriptionScroll.Content = Description; Description.SetBinding(Label.TextProperty, "SelectedTalk.Description"); Content = new StackLayout { Children = { TalkTitle, MainLayout, lowerLayout, descriptionScroll, AddedToggle } }; }
public WrappedPlayerSelectionTemplate() : base() { CircleImage image = new CircleImage(); image.SetBinding(Image.SourceProperty, new Binding("Player.AvatarFileName")); image.Aspect = Aspect.AspectFit; image.BorderColor = Color.White; image.BorderThickness = 3; Label name = new Label(); name.SetBinding(Label.TextProperty, new Binding("Player.DisplayName")); Switch mainSwitch = new Switch(); mainSwitch.SetBinding(Switch.IsToggledProperty, new Binding("IsSelected")); RelativeLayout layout = new RelativeLayout(); layout.Children.Add( image, Constraint.Constant(5), Constraint.Constant(5), Constraint.RelativeToParent(p => p.Width - 60), Constraint.RelativeToParent(p => p.Height - 10)); layout.Children.Add( name, Constraint.Constant(5), Constraint.Constant(5), Constraint.RelativeToParent(p => p.Width - 60), Constraint.RelativeToParent(p => p.Height - 10)); layout.Children.Add( mainSwitch, Constraint.RelativeToParent(p => p.Width - 55), Constraint.Constant(5), Constraint.Constant(50), Constraint.RelativeToParent(p => p.Height - 10)); //Tapped += async (sender, args) => //{ // this.View.BackgroundColor = Color.Red; //}; layout.SetBinding(RelativeLayout.BackgroundColorProperty, new Binding("IsSelected", converter: new IsSelectedToBackgroundConvert(), converterParameter: layout.BackgroundColor)); View = layout; }
public EmployeeViewCell() { var EmpImage = new CircleImage() { HorizontalOptions = LayoutOptions.Start, BorderThickness = 5, //Source = "Dummy.jpg", BorderColor = Color.White.ToFormsColor(), Aspect = Aspect.Fill, }; EmpImage.SetBinding(Image.SourceProperty, new Binding("EmpProfileImage")); EmpImage.WidthRequest = EmpImage.HeightRequest = 40; var nameLabel = new Label { HorizontalOptions = LayoutOptions.Center, XAlign = TextAlignment.Center, TranslationX = 5, TextColor = Xamarin.Forms.Color.White }; nameLabel.FontSize = 18; nameLabel.SetBinding(Label.TextProperty, "FullName"); View = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Start, Padding = new Thickness(5, 1.5, 0, 1.5), HeightRequest = 10, Spacing = 0, Children = { EmpImage, //new Image{Source="index.jpg",HeightRequest=50,WidthRequest=50}, new StackLayout { Spacing = 0, Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.Center, Padding = new Thickness(5, 1.5, 0, 1.5), Children = { nameLabel } }, } }; }
public StackLayout CreateRealtiveLayoutFor() { RelativeLayout MainView = new RelativeLayout { HorizontalOptions = LayoutOptions.Start, BackgroundColor = Xamarin.Forms.Color.Blue, Padding = new Thickness(1, 1, 1, 1), HeightRequest = 10, }; var CoverPage = new iiImage { HorizontalOptions = LayoutOptions.CenterAndExpand }; var CircleImage = new CircleImage { // BorderColor = Color.White.ToFormsColor(), // BorderThickness = 2, HorizontalOptions = LayoutOptions.Fill, }; CircleImage.SetBinding(Image.SourceProperty, "EmpProfileImage"); var tapGestureRecognizer = new TapGestureRecognizer(); tapGestureRecognizer.Tapped += (s, e) => { Console.WriteLine("Yes Clicked"); }; CircleImage.GestureRecognizers.Add(tapGestureRecognizer); MainView.Children.Add(CoverPage, Constraint.Constant(0), Constraint.Constant(0), Constraint.RelativeToParent(parent => { return(parent.Width); }), Constraint.RelativeToParent(parent => { return(parent.Height); })); MainView.Children.Add(CircleImage, Constraint.Constant(0), Constraint.RelativeToView(CoverPage, (parent, sibling) => { return(sibling.Height - 50); }), Constraint.Constant(100), Constraint.Constant(100)); var st = new StackLayout { HeightRequest = 150, Children = { MainView } }; return(st); }
public View CreateCellView() { var nameLabel = new Label(); nameLabel.SetBinding(Label.TextProperty, "name"); nameLabel.TextColor = Colors.DarkGray.ToFormsColor(); var locationLabel = new Label(); locationLabel.SetBinding(Label.TextProperty, "location"); locationLabel.TextColor = Colors.DarkGray.ToFormsColor(); expert = new Label(); expert.SetBinding(Label.TextProperty, "expert"); var profileImage = new CircleImage(); profileImage.Aspect = Aspect.AspectFill; //profileImage.Source = "img1.png"; profileImage.SetBinding(CircleImage.SourceProperty, "image", BindingMode.Default); var retView = new StackLayout { Padding = new Thickness(3, 3, 0, 3), BackgroundColor = Color.White, Orientation = StackOrientation.Horizontal, Children = { profileImage, new StackLayout { VerticalOptions = LayoutOptions.Center, Spacing = 0, Children = { nameLabel, locationLabel } }, GenEventTablelGrid() } }; return(retView); }
public Image CreateShapeView(ShapeViewModel shape) { Image i; if (shape is CircleViewModel) { i = new CircleImage {WidthRequest = shape.Width, HeightRequest = shape.Width, BindingContext = shape}; i.SetBinding(CircleImage.FillColorProperty, new Binding("Color")); } else { i = new Image() { WidthRequest = shape.Width, HeightRequest = shape.Height, BindingContext = shape }; i.SetBinding(BackgroundColorProperty, new Binding("Color")); } i.BindingContext = shape; i.SetBinding(Image.SourceProperty, new Binding("ImageSource")); return i; }
public View CreateCellView() { var nameLabel = new Label(); nameLabel.SetBinding(Label.TextProperty, "name"); nameLabel.TextColor=Colors.DarkGray.ToFormsColor(); var locationLabel = new Label(); locationLabel.SetBinding(Label.TextProperty,"location"); locationLabel.TextColor=Colors.DarkGray.ToFormsColor(); expert = new Label(); expert.SetBinding(Label.TextProperty, "expert"); var profileImage = new CircleImage(); profileImage.Aspect=Aspect.AspectFill; //profileImage.Source = "img1.png"; profileImage.SetBinding(CircleImage.SourceProperty, "image", BindingMode.Default); var retView = new StackLayout { Padding = new Thickness (3, 3, 0, 3), BackgroundColor = Color.White, Orientation = StackOrientation.Horizontal, Children = { profileImage, new StackLayout { VerticalOptions = LayoutOptions.Center, Spacing = 0, Children = { nameLabel, locationLabel } }, GenEventTablelGrid () } }; return retView; }
public SpeakerDetailPage() { Name.SetBinding(Label.TextProperty, nameof(SpeakerDetailPageModel.Name)); TwitterHandle.SetBinding(Label.TextProperty, nameof(SpeakerDetailPageModel.Twitter)); Hero.SetBinding(Image.SourceProperty, nameof(SpeakerDetailPageModel.ImageSr)); Share.SetBinding(Button.CommandProperty, nameof(SpeakerDetailPageModel.ShareCommand)); Sessions.ItemTemplate = new DataTemplate(typeof(ScheduleItemCell)); Sessions.SetBinding(ListView.ItemsSourceProperty, nameof(PrivateSchedulePageModel.Sessions)); Sessions.SetBinding(ListView.SelectedItemProperty, nameof(PrivateSchedulePageModel.SelectedEntry)); Sessions.ItemTapped += SessionList_ItemTapped; Content = new StackLayout { Children = { Name, Hero, TwitterHandle, Sessions, Share } }; }
public RegisterPage() { BackgroundImage = "backImage"; BindingContext = new LoginViewModel(); var profileImage = new CircleImage { WidthRequest = 100, HeightRequest = 100, BorderThickness = 0, HorizontalOptions = LayoutOptions.Center }; profileImage.SetBinding(CircleImage.SourceProperty, "UserModel.ProfileImage"); var userExist = new EventTrigger(); userExist.Event = "TextChanged"; userExist.Actions.Add(new UserAvailabilityTrigger()); var praTextBox = CreateEntryFor("Email", "UserModel.UserName"); praTextBox.Triggers.Add(userExist); var registerButton = new Button { Text = "Join", HorizontalOptions = LayoutOptions.CenterAndExpand, Command = ViewModel.RegisterCommand }; var mainLayout = new StackLayout { HorizontalOptions = LayoutOptions.CenterAndExpand, Padding = new Thickness(15, 0, 15, 0), Children = { profileImage, praTextBox, CreateEntryFor("Passowrd", "UserModel.Password", true), registerButton } }; Content = mainLayout; }
public SpeakerCell() { var nameLabel = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(NamedSize.Large)), Text = "Name" }; //first.SetBinding<Speaker>(Label.TextProperty, s => s.Name); var name = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(22), Font.SystemFontOfSize(NamedSize.Large)), LineBreakMode = LineBreakMode.NoWrap, TextColor = Device.OnPlatform(App.XamBlue, Color.White, Color.White) }; name.SetBinding <Speaker>(Label.TextProperty, s => s.Name); var companyLabel = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(NamedSize.Large)), Text = "Position" }; var company = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(NamedSize.Large)), TextColor = App.XamGray, LineBreakMode = LineBreakMode.WordWrap }; company.SetBinding <Speaker>(Label.TextProperty, s => s.TagLine); CircleImage photo = new CircleImage(); //try //{ int photoSize = Device.OnPlatform(80, 80, 80); photo = new CircleImage { WidthRequest = photoSize, HeightRequest = photoSize, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, }; photo.SetBinding <Speaker>(Image.SourceProperty, s => s.HeadshotLink, converter: new CachableImageSourceFromLinkConverter(TimeSpan.FromDays(3), Utils.GetFile("missingprofile.png"))); //photo.SetBinding<Speaker>(Image.SourceProperty, s => s.Id, // BindingMode.Default, converter: new SpeakerImageConveter()); //} //catch (Exception ex) //{ // var msg = ex.Message; //} var stackright = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, Spacing = 5, Children = { name, company } }; //var stackname = new StackLayout //{ // Orientation = StackOrientation.Horizontal, // HorizontalOptions = LayoutOptions.FillAndExpand, // VerticalOptions = LayoutOptions.FillAndExpand, // Spacing = 5, // Children = {photo, stackright} //}; var stack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(Device.OnPlatform(5, 10, 10), Device.OnPlatform(5, 10, 20)), Spacing = 5, Children = { photo, stackright } }; View = stack; }
public PessoaViewCell() { var pessoaProfileImage = new CircleImage { BorderColor = AppColors.BrandColor(), BorderThickness = 2, HeightRequest = 50, WidthRequest = 50, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; pessoaProfileImage.SetBinding(Image.SourceProperty, "ImagemSource"); var distanciaLabel = new Label() { FontAttributes = FontAttributes.Bold, FontSize = 12, TextColor = Color.FromHex("#666") }; distanciaLabel.SetBinding( Label.TextProperty, new Binding( "Distancia", stringFormat: "{0} Kilometros ") ); var nomeLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), FontSize = 18, TextColor = Color.Black }; nomeLabel.SetBinding(Label.TextProperty, "Nome"); var onlineImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("online.png")), HeightRequest = 8, WidthRequest = 8 }; onlineImage.SetBinding(Image.IsVisibleProperty, "Online"); var onLineLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), Text = "Online", TextColor = AppColors.BrandColor(), FontSize = 12, }; onLineLabel.SetBinding(Label.IsVisibleProperty, "Online"); var offlineImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("offline.png")), HeightRequest = 8, WidthRequest = 8 }; offlineImage.SetBinding(Image.IsVisibleProperty, "Offline"); var offLineLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), Text = "5 horas atrás", TextColor = Color.FromHex("#ddd"), FontSize = 12, }; offLineLabel.SetBinding(Label.IsVisibleProperty, "Offline"); var starLabel = new Label() { FontFamily = Device.OnPlatform("HelveticaNeue-Bold", "sans-serif-black", null), FontSize = 12, TextColor = Color.Gray }; starLabel.SetBinding(Label.TextProperty, "Rating"); var starImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("star.png")), HeightRequest = 12, WidthRequest = 12 }; var ratingStack = new StackLayout() { Spacing = 3, Orientation = StackOrientation.Horizontal, Children = { starImage, starLabel } }; var statusLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { distanciaLabel, onlineImage, onLineLabel, offlineImage, offLineLabel } }; var vetDetailsLayout = new StackLayout { Padding = new Thickness(10, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { nomeLabel, statusLayout, ratingStack } }; var tapImage = new Image() { Source = ImageSource.FromResource(Constants.RetornarCaminhoParaImagens("tap.png")), HorizontalOptions = LayoutOptions.End, HeightRequest = 12, }; var cellLayout = new StackLayout { Spacing = 0, Padding = new Thickness(10, 5, 10, 5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { pessoaProfileImage, vetDetailsLayout, tapImage } }; this.View = cellLayout; }
public MovieTemplate() { var image = new CircleImage { //BorderColor = Color.White, //BorderThickness = 3, HeightRequest = 51, WidthRequest = 51, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.White }; image.SetBinding(Image.SourceProperty, "Movie.Poster"); var NameLabel = new Label { FontFamily = "HelveticaNeue-Medium", FontSize = 18, TextColor = Color.FromHex("#666") }; NameLabel.SetBinding(Label.TextProperty, "Movie.Name"); var ReleaseDateLabel = new Label { FontAttributes = FontAttributes.Bold, FontSize = 13, TextColor = Color.FromHex("#666") }; ReleaseDateLabel.SetBinding(Label.TextProperty, new Binding("Movie.ReleaseDate", stringFormat: "Release Year: {0}")); var statusLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { ReleaseDateLabel } }; var ratingLabel = new Label { FontSize = 13, TextColor = Color.Gray }; ratingLabel.SetBinding(Label.TextProperty, new Binding("Movie.imdbRating", stringFormat: "Rating {0}")); var ratingImage = new Image { Source = "star.png", HeightRequest = 13, WidthRequest = 13 }; var ratingStack = new StackLayout { Spacing = 3, Orientation = StackOrientation.Horizontal, Children = { ratingImage, ratingLabel } }; var DetailLayout = new StackLayout { Padding = new Thickness(10, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { NameLabel, statusLayout, ratingStack } }; var tapImage = new Image { Source = "arrow.png", HorizontalOptions = LayoutOptions.End, HeightRequest = 13 }; var finalLayout = new StackLayout { Spacing = 0, Padding = new Thickness(10, 10, 10, 10), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { image, DetailLayout }, BackgroundColor = Color.White }; this.View = finalLayout; }
void InitializeComponent() { BackgroundColor = Color.White; if (Device.RuntimePlatform == Device.iOS) { this.Padding = new Thickness(0, 20, 0, 0); } var layout = new StackLayout { Orientation = StackOrientation.Vertical, VerticalOptions = LayoutOptions.FillAndExpand, Style = Application.Current.Resources["MasterDetailHeaderUserDetailCell"] as Style }; var user_layout = new StackLayout { Orientation = StackOrientation.Horizontal, Style = Application.Current.Resources["MasterDetailHeaderUserDetailCell"] as Style }; var user_image = new CircleImage { WidthRequest = 55, HeightRequest = 55, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, BorderColor = Color.White, BorderThickness = 2, Margin = new Thickness(15, 10, 0, 0) }; user_image.SetBinding(Image.SourceProperty, "UserPicture"); var user_detail_layout = new StackLayout { VerticalOptions = LayoutOptions.End, Orientation = StackOrientation.Vertical, Margin = new Thickness(5, 0, 10, 0) }; var user_name = new Label { Style = Application.Current.Resources["MasterDetailHeaderFullnameCell"] as Style, LineBreakMode = LineBreakMode.TailTruncation }; user_name.SetBinding(Label.TextProperty, "UserFullname"); var user_account = new Label { Style = Application.Current.Resources["MasterDetailHeaderEmailCell"] as Style, //FontSize = Device.GetNamedSize(NamedSize.Micro, typeof(Label)), LineBreakMode = LineBreakMode.TailTruncation }; user_account.SetBinding(Label.TextProperty, "UserAccount"); user_detail_layout.Children.Add(user_name); user_detail_layout.Children.Add(user_account); user_layout.Children.Add(user_image); user_layout.Children.Add(user_detail_layout); var user_detail_vertical = new StackLayout { VerticalOptions = LayoutOptions.End, Orientation = StackOrientation.Vertical, Margin = new Thickness(15, 10, 10, 0) }; Menu = new MenuListView(); layout.Children.Add(user_layout); layout.Children.Add(Menu); Content = layout; }
public PlayerCell() { var profileImage = new CircleImage { BorderColor = Color.Teal, BorderThickness = 2, HeightRequest = 50, WidthRequest = 50, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, StyleId = "profileImage" }; profileImage.SetBinding <PlayerViewModel>(Image.SourceProperty, x => x.Avatar); var nameLabel = new Label() { FontFamily = "HelveticaNeue-Medium", FontSize = Device.OnPlatform(18, 18, 24), TextColor = Color.White, StyleId = "nameLabel" }; nameLabel.SetBinding <PlayerViewModel>(Label.TextProperty, x => x.Name); var steamLabel = new Label() { FontAttributes = FontAttributes.Bold, FontSize = 12, StyleId = "steamLabel" }; steamLabel.SetBinding <PlayerViewModel>(Label.TextColorProperty, x => x.SteamColor); steamLabel.SetBinding <PlayerViewModel>(Label.TextProperty, x => x.SteamAvailability); var onlineImage = new Image() { Source = PlatformImage.Resolver("online.png"), HeightRequest = 8, WidthRequest = 8, StyleId = "onlineImage" }; onlineImage.SetBinding <PlayerViewModel>(Image.IsVisibleProperty, x => x.ShouldShowAsOnline); var onLineLabel = new Label() { Text = "Online", TextColor = Color.Green, FontSize = 12, IsVisible = false, StyleId = "onlineLabel" }; onLineLabel.SetBinding <PlayerViewModel>(Label.IsVisibleProperty, x => x.ShouldShowAsOnline); // Offline image and label var offlineImage = new Image() { Source = PlatformImage.Resolver("offline.png"), HeightRequest = 8, WidthRequest = 8, StyleId = "offlineImage" }; offlineImage.SetBinding <PlayerViewModel>(Image.IsVisibleProperty, x => x.ShouldShowAsOffline); var offLineLabel = new Label() { Text = "Offline", TextColor = Color.FromHex("#ddd"), FontSize = 12, IsVisible = false, StyleId = "offlineLabel" }; offLineLabel.SetBinding <PlayerViewModel>(Label.IsVisibleProperty, x => x.ShouldShowAsOffline); var statusLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { onlineImage, onLineLabel, offlineImage, offLineLabel, steamLabel } }; var timeLabel = new Label { TextColor = Color.FromHex("#ddd"), FontAttributes = FontAttributes.Italic, FontSize = 10, StyleId = "timeLabel" }; timeLabel.SetBinding <PlayerViewModel>(Label.TextProperty, x => x.LastLogOff); var detailsLayout = new StackLayout { Padding = new Thickness(10, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { nameLabel, statusLayout, timeLabel } }; var tapImage = new Image() { Source = PlatformImage.Resolver("tap.png"), HorizontalOptions = LayoutOptions.End, HeightRequest = 12, StyleId = "tapImage" }; var cellLayout = new StackLayout { Spacing = 0, Padding = new Thickness(10, 5, 10, 5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { profileImage, detailsLayout, tapImage } }; StyleId = "playerCell"; this.View = cellLayout; }
public ViewCell EmpleadoCellTemplate() { var TemplateEmpleado = new ViewCell(); // Labels del template var nombreLabel = new Label(); var apellidoLabel = new Label(); var fotoPerfilImage = new CircleImage { Aspect = Aspect.AspectFit, BorderColor = Color.Black, BorderThickness = 3, HeightRequest = 25, WidthRequest = 25, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Start, FillColor = Color.Black }; // Asignamos las propiedades bindeables, estas propiedades son las del BindingContext, // el cual es el modelo de nuestra Collection en este caso es Empleado. nombreLabel.SetBinding(Label.TextProperty, "Nombre"); apellidoLabel.SetBinding(Label.TextProperty, "Apellido"); fotoPerfilImage.SetBinding(Image.SourceProperty, "FotoPerfil"); /* * Creamos Context Actions, los cuales responderan a un swipe sobre un item en IOS * y long press en Android */ Xamarin.Forms.MenuItem delete = new Xamarin.Forms.MenuItem(); delete.Text = "Eliminar"; delete.IsDestructive = true; delete.SetBinding(Xamarin.Forms.MenuItem.CommandParameterProperty, "."); delete.Clicked += (object sender, EventArgs e) => { var mi = ((Xamarin.Forms.MenuItem)sender); var item = mi.CommandParameter as Empleado; ListData.Remove(item); }; TemplateEmpleado.ContextActions.Add(delete); Xamarin.Forms.MenuItem edit = new Xamarin.Forms.MenuItem(); edit.SetBinding(Xamarin.Forms.MenuItem.CommandParameterProperty, "."); edit.Clicked += (object sender, EventArgs e) => { var mi = (Xamarin.Forms.MenuItem)sender; var item = mi.CommandParameter as Empleado; // Aqui podriamos Abrir unPage ParamArrayAttribute edicion de datos del Empleado // Navigation.PushModalAsync(new EmpleadoInfo(item)); }; edit.Text = "Editar"; TemplateEmpleado.ContextActions.Add(edit); var stack = new StackLayout { Orientation = StackOrientation.Horizontal, Spacing = 10, Padding = 5, Children = { fotoPerfilImage, new StackLayout { Orientation = StackOrientation.Vertical, Spacing = 2, Children = { nombreLabel, apellidoLabel } } } }; TemplateEmpleado.View = stack; return(TemplateEmpleado); }
public VetCell() { var vetProfileImage = new CircleImage { BorderColor = Color.FromHex("#F2995D"), BorderThickness = 2, HeightRequest = 50, WidthRequest = 50, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; vetProfileImage.SetBinding(Image.SourceProperty, "ImageSource"); var nameLabel = new Label() { FontFamily = "HelveticaNeue-Medium", FontSize = 18, TextColor = Color.Black }; nameLabel.SetBinding(Label.TextProperty, "Name"); var distanceLabel = new Label() { FontAttributes = FontAttributes.Bold, FontSize = 12, TextColor = Color.FromHex("#666") }; distanceLabel.SetBinding(Label.TextProperty, new Binding("Distance", stringFormat: "{0} Miles Away")); // Online image and label var onlineImage = new Image() { Source = "online.png", HeightRequest = 8, WidthRequest = 8 }; onlineImage.SetBinding(Image.IsVisibleProperty, "ShouldShowAsOnline"); var onLineLabel = new Label() { Text = "Online", TextColor = Color.FromHex("#F2995D"), FontSize = 12, }; onLineLabel.SetBinding(Label.IsVisibleProperty, "ShouldShowAsOnline"); // Offline image and label var offlineImage = new Image() { Source = "offline.png", HeightRequest = 8, WidthRequest = 8 }; offlineImage.SetBinding(Image.IsVisibleProperty, "ShouldShowAsOffline"); var offLineLabel = new Label() { Text = "5 hours ago", TextColor = Color.FromHex("#ddd"), FontSize = 12, }; offLineLabel.SetBinding(Label.IsVisibleProperty, "ShouldShowAsOffline"); // Vet rating label and star image var starLabel = new Label() { FontSize = 12, TextColor = Color.Gray }; starLabel.SetBinding(Label.TextProperty, "Stars"); var starImage = new Image() { Source = "star.png", HeightRequest = 12, WidthRequest = 12 }; var ratingStack = new StackLayout() { Spacing = 3, Orientation = StackOrientation.Horizontal, Children = { starImage, starLabel } }; var statusLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { distanceLabel, onlineImage, onLineLabel, offlineImage, offLineLabel } }; var vetDetailsLayout = new StackLayout { Padding = new Thickness(10, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { nameLabel, statusLayout, ratingStack } }; var tapImage = new Image() { Source = "tap.png", HorizontalOptions = LayoutOptions.End, HeightRequest = 12, }; var cellLayout = new StackLayout { Spacing = 0, Padding = new Thickness(10, 5, 10, 5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { vetProfileImage, vetDetailsLayout, tapImage } }; this.View = cellLayout; }
public GamePage() { Label header = new Label { Text = "Piłkarzyki", FontSize = 50, FontAttributes = FontAttributes.Bold, HorizontalOptions = LayoutOptions.Center }; Label countDownTimerLabel = new Label { FontSize = 96, HorizontalOptions = LayoutOptions.CenterAndExpand }; countDownTimerLabel.SetBinding(Label.TextProperty, new Binding("TimeLeft")); #region tapGesture var tapGoalForTeamHome = new TapGestureRecognizer(); tapGoalForTeamHome.SetBinding(TapGestureRecognizer.CommandProperty, new Binding("GoalTeamOneTapCommand")); var tapGoalForTeamHomePlayerOne = new TapGestureRecognizer(); tapGoalForTeamHomePlayerOne.SetBinding(TapGestureRecognizer.CommandProperty, new Binding("GoalTeamOneTapCommand")); var tapGoalForTeamHomePlayerTwo = new TapGestureRecognizer(); tapGoalForTeamHomePlayerTwo.SetBinding(TapGestureRecognizer.CommandProperty, new Binding("GoalTeamOneTapCommand")); var tapGoalForTeamAway = new TapGestureRecognizer(); tapGoalForTeamAway.SetBinding(TapGestureRecognizer.CommandProperty, new Binding("GoalTeamTwoTapCommand")); var tapGoalForTeamAwayPlayerOne = new TapGestureRecognizer(); tapGoalForTeamAwayPlayerOne.SetBinding(TapGestureRecognizer.CommandProperty, new Binding("GoalTeamTwoTapCommand")); var tapGoalForTeamAwayPlayerTwo = new TapGestureRecognizer(); tapGoalForTeamAwayPlayerTwo.SetBinding(TapGestureRecognizer.CommandProperty, new Binding("GoalTeamTwoTapCommand")); #endregion tapGesture #region scoreGrid Grid scoreGrid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = 100 } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; #region ScoreTeamOne ContentView contentForTapScoreOne = new ContentView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; contentForTapScoreOne.GestureRecognizers.Add(tapGoalForTeamHome); Label scoreTeamOneLabel = new Label { FontSize = 72, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Color.Accent, TextColor = Color.White, }; scoreTeamOneLabel.SetBinding(Label.TextProperty, new Binding("TeamOneScore")); #endregion ScoreTeamOne #region ScoreTeamTwo ContentView contentForTapScoreTwo = new ContentView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand }; contentForTapScoreTwo.GestureRecognizers.Add(tapGoalForTeamAway); Label scoreTeamTwoLabel = new Label { FontSize = 72, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Color.Accent, TextColor = Color.White }; scoreTeamTwoLabel.SetBinding(Label.TextProperty, new Binding("TeamTwoScore")); #endregion ScoreTeamTwo scoreGrid.Children.Add(new BoxView { BackgroundColor = Color.Accent }, 0, 0); scoreGrid.Children.Add(scoreTeamOneLabel, 0, 0); scoreGrid.Children.Add(contentForTapScoreOne, 0, 0); scoreGrid.Children.Add(new BoxView { BackgroundColor = Color.Accent }, 1, 0); scoreGrid.Children.Add(scoreTeamTwoLabel, 1, 0); scoreGrid.Children.Add(contentForTapScoreTwo, 1, 0); #endregion scoreGrid #region playersGrid Grid playersGrid = new Grid { VerticalOptions = LayoutOptions.FillAndExpand, RowDefinitions = { new RowDefinition { Height = 100 }, new RowDefinition { Height = 100 } }, ColumnDefinitions = { new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) }, new ColumnDefinition { Width = new GridLength(1, GridUnitType.Star) } } }; CircleImage teamHomePlayer1 = new CircleImage { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand, Aspect = Aspect.AspectFit, BorderColor = Color.Accent, BorderThickness = 3 }; teamHomePlayer1.SetBinding(Image.SourceProperty, new Binding("TeamHomePlayers[0].AvatarFileName")); tapGoalForTeamHomePlayerOne.SetBinding(TapGestureRecognizer.CommandParameterProperty, new Binding("TeamHomePlayers[0]")); teamHomePlayer1.GestureRecognizers.Add(tapGoalForTeamHomePlayerOne); CircleImage teamHomePlayer2 = new CircleImage { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand, Aspect = Aspect.AspectFit, BorderColor = Color.Accent, BorderThickness = 3 }; teamHomePlayer2.SetBinding(Image.SourceProperty, new Binding("TeamHomePlayers[1].AvatarFileName")); tapGoalForTeamHomePlayerTwo.SetBinding(TapGestureRecognizer.CommandParameterProperty, new Binding("TeamHomePlayers[1]")); teamHomePlayer2.GestureRecognizers.Add(tapGoalForTeamHomePlayerTwo); CircleImage teamAwayPlayer1 = new CircleImage { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand, Aspect = Aspect.AspectFit, BorderColor = Color.Accent, BorderThickness = 3 }; teamAwayPlayer1.SetBinding(Image.SourceProperty, new Binding("TeamAwayPlayers[0].AvatarFileName")); tapGoalForTeamAwayPlayerOne.SetBinding(TapGestureRecognizer.CommandParameterProperty, new Binding("TeamAwayPlayers[0]")); teamAwayPlayer1.GestureRecognizers.Add(tapGoalForTeamAwayPlayerOne); CircleImage teamAwayPlayer2 = new CircleImage { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.CenterAndExpand, Aspect = Aspect.AspectFit, BorderColor = Color.Accent, BorderThickness = 3 }; teamAwayPlayer2.SetBinding(Image.SourceProperty, new Binding("TeamAwayPlayers[1].AvatarFileName")); tapGoalForTeamAwayPlayerTwo.SetBinding(TapGestureRecognizer.CommandParameterProperty, new Binding("TeamAwayPlayers[1]")); teamAwayPlayer2.GestureRecognizers.Add(tapGoalForTeamAwayPlayerTwo); playersGrid.Children.Add(teamHomePlayer1, 0, 0); playersGrid.Children.Add(teamHomePlayer2, 0, 1); playersGrid.Children.Add(teamAwayPlayer1, 1, 0); playersGrid.Children.Add(teamAwayPlayer2, 1, 1); #endregion playersGrid Button startGameButton = new Button { HorizontalOptions = LayoutOptions.FillAndExpand }; startGameButton.SetBinding(Button.CommandProperty, new Binding("StartOrPauseGameCommand")); startGameButton.SetBinding(Button.TextProperty, new Binding("MatchStatusText")); ToolbarItem resetToolbarItem = new ToolbarItem(); resetToolbarItem.Order = ToolbarItemOrder.Primary; resetToolbarItem.Icon = "resetGameIcon.png"; resetToolbarItem.SetBinding(ToolbarItem.CommandProperty, new Binding("ResetGameCommand")); ToolbarItems.Add(resetToolbarItem); Content = new StackLayout { Children = { countDownTimerLabel, scoreGrid, playersGrid, startGameButton } }; }
public SelectableViewCell() { string fontfamily = string.Empty; Color _colorBoxViw = Color.Transparent; switch (Device.RuntimePlatform) { case Device.iOS: fontfamily = "MAISONNEUE-BOOK"; _colorBoxViw = App.BrandColor; break; default: fontfamily = "MAISONNEUE-BOOK.TTF#MAISONNEUE-BOOK"; _colorBoxViw = App.BrandColor; break; } try { //declare here for student image var imgcircle = new CircleImage { BorderColor = Color.White, BorderThickness = 2, HeightRequest = 40, WidthRequest = 40, BackgroundColor = Color.Transparent, Aspect = Aspect.Fill, HorizontalOptions = LayoutOptions.Start, //Source= ImageSource.FromFile("shivam.png"), FillColor = Color.Black, }; rootGrid = new Grid { Padding = new Thickness(5, 5, 5, 5), ColumnDefinitions = { new ColumnDefinition { Width = GridLength.Star }, new ColumnDefinition { Width = GridLength.Auto } }, BackgroundColor = Color.WhiteSmoke }; View = rootGrid; var check = new BoxView { Color = _colorBoxViw, HeightRequest = 12, WidthRequest = 12 }; CheckView = check; //here we are declare child grid var childGrid = new Grid { Padding = new Thickness(5, 5, 5, 5), RowDefinitions = { new RowDefinition { Height = new GridLength(1, GridUnitType.Auto) }, new RowDefinition { Height = new GridLength(15, GridUnitType.Star) } }, ColumnDefinitions = { new ColumnDefinition { Width = GridLength.Auto }, new ColumnDefinition { Width = GridLength.Auto } }, BackgroundColor = Color.Red, Margin = new Thickness(0, 5, 0, 0) }; //declare here for student name var _StudentNametext = new Label() { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.CenterAndExpand, TextColor = App.BrandColor }; _StudentNametext.FontFamily = App.fontFamilyHead; _StudentNametext.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)); _StudentNametext.TextColor = Color.Black; //declare here for student id var _StudentIDtext = new Label() { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Center }; _StudentIDtext.FontFamily = App.fontFamilyHead; _StudentIDtext.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Label)); _StudentIDtext.TextColor = Color.Black; //imgcircle.SetBinding(Image.SourceProperty, new Binding("image",BindingMode.Default,source:)); imgcircle.SetBinding(Image.SourceProperty, "ImageUri"); //imgcircle.Source = GetDefaultImageSource(); _StudentNametext.SetBinding(Label.TextProperty, new Binding("name")); _StudentIDtext.SetBinding(Label.TextProperty, new Binding("id")); childGrid.Children.Add(imgcircle, 0, 0); Grid.SetRowSpan(imgcircle, 2); childGrid.Children.Add(_StudentIDtext, 1, 0); childGrid.Children.Add(_StudentNametext, 1, 1); DataView = childGrid; } catch (Exception ex) { Console.WriteLine(ex.ToString()); } }
public ProfilePage(MemberInfo info = null) { #region Main View BackgroundImage = "backImage"; RelativeLayout MainView = new RelativeLayout { HorizontalOptions = LayoutOptions.Start, BackgroundColor = Xamarin.Forms.Color.Transparent, }; #endregion #region Profile Image //Profile Image var CircleImage = new CircleImage { Source = "ProfileImage", BorderColor = Color.White, BorderThickness = 2, HorizontalOptions = LayoutOptions.CenterAndExpand, }; CircleImage.SetBinding(Image.SourceProperty, "ProfileImage"); MainView.Children.Add(CircleImage, Constraint.Constant(10), Constraint.Constant(10), Constraint.RelativeToParent(parent => { return(120); }), Constraint.RelativeToParent(parent => { return(120); })); #endregion #region Text Label //Full Name var namelbl = new PRALabel { HeightRequest = 70, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, WidthRequest = 70, TextColor = Color.White }; namelbl.SetBinding(Label.TextProperty, "FullName"); MainView.Children.Add(namelbl, Constraint.RelativeToView(CircleImage, (parent, sibling) => { return(sibling.Width + 30); }), Constraint.RelativeToView(CircleImage, (parent, sibling) => { return(sibling.Height - 50); }), Constraint.Constant(100), Constraint.Constant(100)); //Date of Birth var dateLbl = new PRALabel { HeightRequest = 70, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, WidthRequest = 70, TextColor = Color.White }; dateLbl.SetBinding(Label.TextProperty, new Binding("DateOfBirth") { StringFormat = "Birth {0:dd MMM}" }); MainView.Children.Add(dateLbl, Constraint.RelativeToView(CircleImage, (parent, sibling) => { return(sibling.X + 25); }), Constraint.RelativeToView(namelbl, (parent, sibling) => { return(sibling.Height + sibling.Y + 30); }), Constraint.Constant(100), Constraint.Constant(100)); //Date of Joining var joiningLbl = new PRALabel { HeightRequest = 70, XAlign = TextAlignment.Center, YAlign = TextAlignment.Center, WidthRequest = 70, TextColor = Color.White }; joiningLbl.SetBinding(Label.TextProperty, new Binding("DateOfJoining") { StringFormat = "Join {0:dd MMM}" }); MainView.Children.Add(joiningLbl, Constraint.RelativeToView(namelbl, (parent, sibling) => { return(sibling.X + 35); }), Constraint.RelativeToView(dateLbl, (parent, sibling) => { return(sibling.Height + sibling.Y - 20); }), Constraint.Constant(100), Constraint.Constant(100)); #endregion #region Social Icons var fbIcon = new CircleImage { Source = "fbIcon", BorderColor = Color.White, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var twtIcon = new CircleImage { Source = "twtIcon", BorderColor = Color.White, HorizontalOptions = LayoutOptions.CenterAndExpand, }; var lkIcon = new CircleImage { Source = "lkIcon", BorderColor = Color.White, HorizontalOptions = LayoutOptions.CenterAndExpand, }; //FB Icon MainView.Children.Add(fbIcon, Constraint.RelativeToView(CircleImage, (parent, sibling) => { return(sibling.X + 10); }), Constraint.RelativeToView(dateLbl, (parent, sibling) => { return(sibling.Height + sibling.Y + 20); }), Constraint.Constant(50), Constraint.Constant(50)); //Twitter MainView.Children.Add(twtIcon, Constraint.RelativeToView(fbIcon, (parent, sibling) => { return(sibling.X + 35); }), Constraint.RelativeToView(fbIcon, (parent, sibling) => { return(sibling.Height + sibling.Y + 20); }), Constraint.Constant(50), Constraint.Constant(50)); //Linkedin MainView.Children.Add(lkIcon, Constraint.RelativeToView(twtIcon, (parent, sibling) => { return(sibling.X + 50); }), Constraint.RelativeToView(twtIcon, (parent, sibling) => { return(sibling.Height + sibling.Y + 20); }), Constraint.Constant(50), Constraint.Constant(50)); #endregion Content = MainView; }
/// <summary> /// Method that creates the page content /// </summary> public View SetContent() { var emblem = new Image { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, HeightRequest = 160 }; emblem.SetBinding(Image.SourceProperty, UploadingViewModel.EmblemProperty); var spinner = new CircleImage { Source = "Resources/spinner.gif", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, }; spinner.SetBinding(Image.SourceProperty, UploadingViewModel.SpinnerProperty); var text = new Label { TextColor = Color.FromHex(Definitions.DefaultTextColor), FontSize = Definitions.HeaderFontSize, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; text.SetBinding(Label.TextProperty, UploadingViewModel.UploaderTextProperty); text.SetBinding(Label.IsVisibleProperty, UploadingViewModel.UploadingTextVisibilityProperty); var img = new Image { HeightRequest = 120, WidthRequest = 120, HorizontalOptions = LayoutOptions.Center, }; img.SetBinding(Image.RotationProperty, UploadingViewModel.RotateProperty); img.SetBinding(Image.SourceProperty, UploadingViewModel.SpinnerProperty); img.SetBinding(Image.IsVisibleProperty, UploadingViewModel.UploadingSpinnerVisibilityProperty); var loadingStack = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 20, 0, 0), Spacing = 60, Children = { img, text, } }; var layout = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 70, 10, 10), Children = { emblem, loadingStack, ErrorStack(), } }; return(layout); }
private async void setCont() { if (!CrossConnectivity.Current.IsConnected) { await DisplayAlert("Warning", "Please, check your internet settings!", "OK"); } else { DatabaseFunctions dbf = new DatabaseFunctions(); var userJson = await dbf.getUsers(); ObservableCollection <Users> listofevents = userJson; ObservableCollection <Whoattended> whoevents = wholist; ObservableCollection <Users> reallyList = new ObservableCollection <Users>(); List <string> list = new List <string>(); foreach (var item in whoevents) { if (eventId == item.eventId) { list.Add(item.profile); } } foreach (var item in list) { foreach (var item2 in listofevents) { if (item == item2.Profile) { reallyList.Add(item2); } } } var personDataTemplate = new DataTemplate(() => { var grid = new Grid(); var nameLabel = new Label { TextColor = Color.White, FontAttributes = FontAttributes.Bold, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, HorizontalTextAlignment = TextAlignment.Center, VerticalTextAlignment = TextAlignment.Center, BackgroundColor = Color.Transparent }; var uniLabel = new Label() { TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.Transparent }; var depLabel = new Label { TextColor = Color.White, HorizontalTextAlignment = TextAlignment.Center, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.Transparent }; var webImage = new CircleImage { BorderThickness = 0, HeightRequest = 250, WidthRequest = 250, Aspect = Aspect.AspectFit, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center }; webImage.SetBinding(Image.SourceProperty, "ProfilePicture"); nameLabel.SetBinding(Label.TextProperty, "Name"); uniLabel.SetBinding(Label.TextProperty, "University"); depLabel.SetBinding(Label.TextProperty, "Department"); grid.Children.Add(webImage, 0, 0); Grid.SetRowSpan(webImage, 2); grid.Children.Add(nameLabel, 1, 0); Grid.SetColumnSpan(nameLabel, 2); grid.Children.Add(uniLabel, 1, 1); grid.Children.Add(depLabel, 2, 1); viewCell = new ViewCell { View = grid }; var joinAction = new MenuItem { Text = "Facebook" }; joinAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); joinAction.Clicked += (sender, e) => { var mi = ((MenuItem)sender); Users bindingUsers = (Users)mi.BindingContext; Device.OpenUri(new Uri("http://www.facebook.com/" + bindingUsers.Profile)); }; viewCell.ContextActions.Add(joinAction); return(viewCell); }); lw = new ListView() { IsPullToRefreshEnabled = true, ItemsSource = reallyList, ItemTemplate = personDataTemplate, VerticalOptions = LayoutOptions.Center, BackgroundColor = Color.Transparent }; lw.Refreshing += Lw_Refreshing; Content = new ScrollView { Content = new StackLayout() { Children = { lw } } }; } }
public UserRegistrationView() { BindingContext = new UserViewModel(this.Navigation); indicator = new ActivityIndicator { Color = Colors.DarkGray.ToFormsColor(), HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; //indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading"); //indicator.SetBinding (ActivityIndicator.IsVisibleProperty, "IsLoading"); stack_CoverPage = new StackLayout { WidthRequest = Width, HeightRequest = Width / 4, //BackgroundColor=Color.Red, BackgroundColor = Colors.DarkGray.ToFormsColor(), }; img_User = new CircleImage { WidthRequest = Width / 4, HeightRequest = Width / 4, HorizontalOptions = LayoutOptions.Center, //BackgroundColor=Color.Yellow, TranslationY = -((Width / 4) / 2 + 10), Aspect = Aspect.Fill, Source = "CircleImage.png", }; img_User.SetBinding(CircleImage.SourceProperty, "ImageSource", BindingMode.Default); ViewModel.ProfilePicture = img_User; btn_camera = new Image { Source = "camera.png", WidthRequest = Width / 8, HeightRequest = Height / 8, HorizontalOptions = LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, BackgroundColor = Xamarin.Forms.Color.Red, }; var Cameratap = new TapGestureRecognizer(OnCameraTapped); btn_camera.IsEnabled = true; btn_camera.GestureRecognizers.Clear(); btn_camera.GestureRecognizers.Add(Cameratap); btn_gallery = new Image { Source = "gallery.png", WidthRequest = Width / 8, HeightRequest = Height / 8, HorizontalOptions = LayoutOptions.End, VerticalOptions = LayoutOptions.Center, BackgroundColor = Xamarin.Forms.Color.Green, }; var Gallerytap = new TapGestureRecognizer(OnGalleryTapped); btn_gallery.IsEnabled = true; btn_gallery.GestureRecognizers.Clear(); btn_gallery.GestureRecognizers.Add(Gallerytap); stack_pop = new StackLayout { HeightRequest = Width / 2, WidthRequest = Width / 2, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Xamarin.Forms.Color.White, TranslationY = Width / 2, Opacity = 1, Children = { new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, TranslationY = Width / 6, Children = { btn_camera, btn_gallery } } } }; stack_popup = new StackLayout { WidthRequest = Width, HeightRequest = Height, BackgroundColor = Xamarin.Forms.Color.Transparent, Children = { stack_pop } }; image_bg = new Image { WidthRequest = Width, HeightRequest = Height, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Source = "bg.png", IsVisible = false }; var PopUpGestureRecognizer = new TapGestureRecognizer { //ViewModel.SelectPictureCommand.Execute(null); Command = new Command(() => { //ViewModel.SelectPictureCommand.Execute(null); var eAndN = new Tuple <Easing, string>[] { new Tuple <Easing, string> (Easing.Linear, "Linear") }; double w = Width; double h = Height; var newPos = new Rectangle(0, h, w, h); var eAndName = eAndN[iClicks]; var easing = eAndName.Item1; stack_popup.LayoutTo(newPos, 80, easing); iClicks %= eAndN.Length; image_bg.IsVisible = false; }), NumberOfTapsRequired = 1 }; stack_popup.GestureRecognizers.Add(PopUpGestureRecognizer); var ProfilePictureGestureRecognizer = new TapGestureRecognizer { //ViewModel.SelectPictureCommand.Execute(null); Command = new Command(() => { var eAndN = new Tuple <Easing, string>[] { new Tuple <Easing, string> (Easing.Linear, "Linear") }; double w = Width; double h = Height; var newPos = new Rectangle(0, 0, w, h); var eAndName = eAndN[iClicks]; var easing = eAndName.Item1; stack_popup.LayoutTo(newPos, 80, easing); iClicks %= eAndN.Length; image_bg.IsVisible = true; }), NumberOfTapsRequired = 1 }; img_User.GestureRecognizers.Add(ProfilePictureGestureRecognizer); txt_Name = new EditText { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, Placeholder = "FullName", TextColor = Colors.DarkGray.ToFormsColor(), BackgroundColor = Xamarin.Forms.Color.Transparent, HeightRequest = Width / 10, }; txt_Name.SetBinding(Entry.TextProperty, "UserRegInfo.name"); txt_Email = new EditText { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, Keyboard = Keyboard.Email, Placeholder = "Email", TextColor = Colors.DarkGray.ToFormsColor(), BackgroundColor = Xamarin.Forms.Color.Transparent, HeightRequest = Width / 10 }; txt_Email.SetBinding(Entry.TextProperty, "UserRegInfo.email"); txt_Password = new EditText { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, IsPassword = true, Placeholder = "Password", TextColor = Colors.DarkGray.ToFormsColor(), BackgroundColor = Xamarin.Forms.Color.Transparent, HeightRequest = Width / 10 }; txt_Password.SetBinding(Entry.TextProperty, "UserRegInfo.password"); picker_Country = new CustomPicker { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, Title = "Location", HeightRequest = Width / 10, BackgroundColor = Xamarin.Forms.Color.Transparent, }; picker_Country.SelectedIndexChanged += ((sender, e) => { ViewModel.SelectedIndex = picker_Country.SelectedIndex; }); btn_Submit = new Button { WidthRequest = Width / 2, HorizontalOptions = LayoutOptions.Center, HeightRequest = Width / 8, Text = "Submit", FontSize = 17, TextColor = Xamarin.Forms.Color.White, BackgroundColor = Colors.DarkGray.ToFormsColor(), //CommandParameter = 1, Command = ViewModel.RegisterUser, }; stack_TopView = new StackLayout { HorizontalOptions = LayoutOptions.Fill, HeightRequest = Width / 3, Padding = new Thickness(0, 0, 0, Height / 45), //BackgroundColor=Color.Blue, Children = { stack_CoverPage, img_User } }; lbl_Expert = new Label { Text = "Experts", FontSize = 18, TextColor = Colors.DarkGray.ToFormsColor(), FontAttributes = FontAttributes.Bold }; stack_MiddleView = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.StartAndExpand, Padding = new Thickness(Width / 8, Height / 40, Width / 8, 0), //BackgroundColor=Color.Pink, Spacing = Height / 45, Children = { txt_Name, txt_Email, txt_Password, picker_Country, lbl_Expert } }; img_iOS = new Image { WidthRequest = Width / 7, HeightRequest = Width / 7, HorizontalOptions = LayoutOptions.Start, Source = "iOS.png", BackgroundColor = Colors.DarkGray.ToFormsColor(), IsEnabled = false }; var iOStap = new TapGestureRecognizer(OniOSTapped); iOStap.NumberOfTapsRequired = 1; img_iOS.IsEnabled = true; img_iOS.GestureRecognizers.Clear(); img_iOS.GestureRecognizers.Add(iOStap); img_Certified = new Image { WidthRequest = Width / 7, HeightRequest = Width / 7, HorizontalOptions = LayoutOptions.Center, Source = "Certified.png", BackgroundColor = Colors.DarkGray.ToFormsColor(), IsEnabled = false }; var Certifiedtap = new TapGestureRecognizer(OnCertifiedTapped); img_Certified.IsEnabled = true; img_Certified.GestureRecognizers.Clear(); img_Certified.GestureRecognizers.Add(Certifiedtap); img_Android = new Image { WidthRequest = Width / 7, HeightRequest = Width / 7, HorizontalOptions = LayoutOptions.End, Source = "Android.png", BackgroundColor = Colors.DarkGray.ToFormsColor(), IsEnabled = false }; var Androidtap = new TapGestureRecognizer(OnAndroidTapped); Androidtap.NumberOfTapsRequired = 1; img_Android.IsEnabled = true; img_Android.GestureRecognizers.Clear(); img_Android.GestureRecognizers.Add(Androidtap); img_Forms = new Image { WidthRequest = Width / 7, HeightRequest = Width / 7, HorizontalOptions = LayoutOptions.Start, Source = "Forms.png", BackgroundColor = Colors.DarkGray.ToFormsColor(), IsEnabled = false }; var Formstap = new TapGestureRecognizer(OnFormsTapped); img_Forms.IsEnabled = true; img_Forms.GestureRecognizers.Clear(); img_Forms.GestureRecognizers.Add(Formstap); img_Insights = new Image { WidthRequest = Width / 7, HeightRequest = Width / 7, HorizontalOptions = LayoutOptions.Center, Source = "Insight.png", BackgroundColor = Colors.DarkGray.ToFormsColor(), IsEnabled = false }; var Insightstap = new TapGestureRecognizer(OnInsightTapped); img_Insights.IsEnabled = true; img_Insights.GestureRecognizers.Clear(); img_Insights.GestureRecognizers.Add(Insightstap); img_Testcloud = new Image { WidthRequest = Width / 7, HeightRequest = Width / 7, HorizontalOptions = LayoutOptions.End, Source = "TestCloud.png", BackgroundColor = Colors.DarkGray.ToFormsColor(), IsEnabled = false }; var Testcloudtap = new TapGestureRecognizer(OnTestCloudTapped); img_Testcloud.IsEnabled = true; img_Testcloud.GestureRecognizers.Clear(); img_Testcloud.GestureRecognizers.Add(Testcloudtap); stack_FirstExpert = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.StartAndExpand, Orientation = StackOrientation.Horizontal, //BackgroundColor=Color.Yellow, Spacing = Height / 40, Children = { img_iOS, img_Certified, img_Android } }; stack_SecondExpert = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.StartAndExpand, Orientation = StackOrientation.Horizontal, //BackgroundColor=Color.Red, Spacing = Height / 40, Children = { img_Forms, img_Insights, img_Testcloud } }; StackLayout stack_MainLayout = new StackLayout { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions = LayoutOptions.Fill, //BackgroundColor=Color.Aqua, Spacing = Width / 25, Children = { stack_MiddleView, stack_FirstExpert, stack_SecondExpert, btn_Submit } }; scroll_Main = new ScrollView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.Start, }; scroll_Main.Content = stack_MainLayout; mainLayout = new StackLayout { HorizontalOptions = LayoutOptions.Fill, VerticalOptions = LayoutOptions.End, BackgroundColor = Xamarin.Forms.Color.White, WidthRequest = Width, HeightRequest = Height, Children = { stack_TopView, scroll_Main } }; rltv_main = new RelativeLayout { WidthRequest = Width, HeightRequest = Height }; rltv_main.Children.Add(mainLayout, Constraint.Constant(0), Constraint.Constant(0), Constraint.Constant(Width), Constraint.Constant(Height)); rltv_main.Children.Add(image_bg, Constraint.Constant(0), Constraint.Constant(0), Constraint.Constant(Width), Constraint.Constant(Height)); rltv_main.Children.Add(stack_popup, Constraint.Constant(0), Constraint.Constant(Height), Constraint.Constant(Width), Constraint.Constant(Height)); this.Content = rltv_main; }
private void BuildView() { var img = new CircleImage(); img.WidthRequest = 55; img.HeightRequest = img.WidthRequest; img.Aspect = Aspect.AspectFill; img.SetBinding(Image.SourceProperty, "Image"); img.VerticalOptions = LayoutOptions.Fill; img.HorizontalOptions = LayoutOptions.Start; var nameLabel = new CustomLabel(); nameLabel.SetBinding(Label.TextProperty, "Name"); nameLabel.VerticalOptions = LayoutOptions.Center; nameLabel.HorizontalOptions = LayoutOptions.Start; nameLabel.TextColor = Color.Black; nameLabel.FontFamily = UIUtils.FONT_BEBAS_REGULAR; nameLabel.FontSize = 18; var row1 = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 65, Padding = new Thickness(10, 10, 20, 0), Children = { img, nameLabel } }; if (_isMua) { var priceLabel = new CustomLabel(); priceLabel.SetBinding(Label.TextProperty, "TotalPrice"); priceLabel.VerticalOptions = LayoutOptions.Center; priceLabel.HorizontalOptions = LayoutOptions.EndAndExpand; priceLabel.TextColor = Color.Black; priceLabel.FontFamily = UIUtils.FONT_SFUIDISPLAY_SEMIBOLD; priceLabel.FontSize = 16; row1.Children.Add(priceLabel); } else { var confirmed = new Image(); //confirmed.Source = ImageSource.FromResource("TiroApp.Images.confirmed.png"); confirmed.SetBinding(Image.SourceProperty, "ConfirmedImageSource"); confirmed.HorizontalOptions = LayoutOptions.EndAndExpand; confirmed.VerticalOptions = LayoutOptions.Center; confirmed.HeightRequest = 50; confirmed.WidthRequest = 70; confirmed.Margin = new Thickness(0, 0, 20, 10); confirmed.SetBinding(VisualElement.IsVisibleProperty, "IsStatusNotNew"); row1.Children.Add(confirmed); } var row2 = new CustomLabel(); row2.SetBinding(Label.TextProperty, "ServicesName"); row2.VerticalOptions = LayoutOptions.Center; row2.HorizontalOptions = LayoutOptions.Start; row2.TextColor = Color.Black; row2.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; row2.FontSize = 16; row2.Margin = new Thickness(10, 0, 0, 0); var addrLabel = new CustomLabel(); addrLabel.SetBinding(Label.TextProperty, "Address"); addrLabel.VerticalOptions = LayoutOptions.Center; addrLabel.HorizontalOptions = LayoutOptions.Start; addrLabel.TextColor = Color.FromHex("CCCCCC"); addrLabel.FontFamily = UIUtils.FONT_SFUIDISPLAY_REGULAR; addrLabel.FontSize = 14; var dateLabel = new CustomLabel(); dateLabel.SetBinding(Label.TextProperty, "Date"); dateLabel.VerticalOptions = LayoutOptions.Center; dateLabel.HorizontalOptions = LayoutOptions.EndAndExpand; dateLabel.TextColor = Props.ButtonColor; dateLabel.FontFamily = UIUtils.FONT_BEBAS_REGULAR; dateLabel.FontSize = 14; var row3 = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, HeightRequest = 30, Padding = new Thickness(10, 0, 20, 0), Children = { addrLabel, dateLabel } }; var l = new StackLayout() { Orientation = StackOrientation.Vertical, Spacing = 0 }; l.Children.Add(row1); l.Children.Add(row2); l.Children.Add(row3); if (_isMua) { var btn1 = UIUtils.MakeButton("DECLINE", UIUtils.FONT_SFUIDISPLAY_MEDIUM); btn1.TextColor = Props.ButtonColor; btn1.BackgroundColor = Color.FromHex("F8F8F8"); btn1.SetBinding(UIUtils.TagProperty, "Id"); btn1.Clicked += (o, a) => { OnDeclineClick?.Invoke(o, a); }; var btn2 = UIUtils.MakeButton("CONFIRM", UIUtils.FONT_SFUIDISPLAY_MEDIUM); btn2.SetBinding(UIUtils.TagProperty, "Id"); btn2.Clicked += (o, a) => { OnConfirmClick?.Invoke(o, a); }; var row4 = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Spacing = 0, Children = { btn1, btn2 } }; row4.SetBinding(VisualElement.IsVisibleProperty, "IsStatusNew"); l.Children.Add(row4); } var separator = UIUtils.MakeSeparator(true); l.Children.Add(separator); var al = new AbsoluteLayout(); AbsoluteLayout.SetLayoutFlags(l, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(l, new Rectangle(0f, 0f, 1f, 1f)); al.Children.Add(l); if (!_isMua) { var overlayText = new CustomLabel(); overlayText.Text = "Pending Confirmation from \nMakeup artist"; overlayText.FontFamily = UIUtils.FONT_SFUIDISPLAY_BOLD; overlayText.FontSize = 16; overlayText.TextColor = Props.ButtonInfoPageColor; overlayText.HorizontalTextAlignment = TextAlignment.Center; overlayText.HorizontalOptions = LayoutOptions.CenterAndExpand; overlayText.Rotation = 350; overlayText.SetBinding(VisualElement.IsVisibleProperty, "IsStatusNew"); var overlay = new BoxView { Color = Color.FromRgba(255, 255, 255, 124) }; overlay.SetBinding(VisualElement.IsVisibleProperty, "IsStatusNew"); AbsoluteLayout.SetLayoutFlags(overlay, AbsoluteLayoutFlags.All); AbsoluteLayout.SetLayoutBounds(overlay, new Rectangle(0f, 0f, 1f, 1f)); al.Children.Add(overlay); AbsoluteLayout.SetLayoutFlags(overlayText, AbsoluteLayoutFlags.PositionProportional); AbsoluteLayout.SetLayoutBounds(overlayText, new Rectangle(0.4f, 0.4f, AbsoluteLayout.AutoSize, AbsoluteLayout.AutoSize)); al.Children.Add(overlayText); } View = al; }
public SpeakerDetailsCelliOS() { var nameLabel = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(NamedSize.Large)), Text = "Name", TextColor = App.XamBlue }; //first.SetBinding<Speaker>(Label.TextProperty, s => s.Name); var name = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(22), Font.SystemFontOfSize(NamedSize.Large)), LineBreakMode = LineBreakMode.NoWrap, TextColor = Color.White }; name.SetBinding <Speaker>(Label.TextProperty, s => s.Name); var companyLabel = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(NamedSize.Large)), Text = "Position", TextColor = App.XamBlue }; var company = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(NamedSize.Large), Font.SystemFontOfSize(NamedSize.Large)), TextColor = App.XamGray, LineBreakMode = LineBreakMode.WordWrap }; company.SetBinding <Speaker>(Label.TextProperty, s => s.TagLine); CircleImage photo = new CircleImage(); try { int photoSize = Device.OnPlatform(80, 100, 80); photo = new CircleImage { WidthRequest = photoSize, HeightRequest = photoSize, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, //Source = ImageSource.FromFile("missingprofile.png") }; photo.SetBinding <Speaker>(Image.SourceProperty, s => s.HeadshotLink, converter: new CachableImageSourceFromLinkConverter(TimeSpan.FromDays(3), Utils.GetFile("missingprofile.png"))); //photo.SetBinding<Speaker>(Image.SourceProperty, s => s, // BindingMode.Default, // converter: new SpeakerImageConveter()); } catch (Exception ex) { var msg = ex.Message; } var stackright = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 5, Children = { nameLabel, name, companyLabel, company } }; var stack = new StackLayout { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(Device.OnPlatform(0, 10, 10), Device.OnPlatform(0, 10, 20)), Spacing = 5, BackgroundColor = Color.Transparent, Children = { photo, stackright } }; var aboutSpeaker = new Label { VerticalOptions = LayoutOptions.Center, Font = Device.OnPlatform(Font.OfSize("HelveticaNeue-Light", NamedSize.Small), Font.SystemFontOfSize(20), Font.SystemFontOfSize(NamedSize.Large)), LineBreakMode = LineBreakMode.WordWrap, TextColor = Color.White }; aboutSpeaker.SetBinding <Speaker>(Label.TextProperty, s => s.Bio); var scrollView = new ScrollView { VerticalOptions = LayoutOptions.Fill, Orientation = ScrollOrientation.Vertical, Content = aboutSpeaker, HeightRequest = 300 }; var resultStack = new StackLayout { Orientation = StackOrientation.Vertical, HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions = LayoutOptions.FillAndExpand, Spacing = 15, Children = { stack, scrollView }, BackgroundColor = Color.Transparent }; View = resultStack; }
public UserRegistrationView () { BindingContext = new UserViewModel(this.Navigation); indicator = new ActivityIndicator { Color = Colors.DarkGray.ToFormsColor(), HorizontalOptions=LayoutOptions.Center, VerticalOptions=LayoutOptions.Center, }; //indicator.SetBinding (ActivityIndicator.IsRunningProperty, "IsLoading"); //indicator.SetBinding (ActivityIndicator.IsVisibleProperty, "IsLoading"); stack_CoverPage = new StackLayout { WidthRequest=Width, HeightRequest = Width/4, //BackgroundColor=Color.Red, BackgroundColor=Colors.DarkGray.ToFormsColor(), }; img_User = new CircleImage { WidthRequest = Width/4, HeightRequest = Width/4, HorizontalOptions = LayoutOptions.Center, //BackgroundColor=Color.Yellow, TranslationY=-((Width/4)/2+10), Aspect=Aspect.Fill, Source="CircleImage.png", }; img_User.SetBinding(CircleImage.SourceProperty, "ImageSource", BindingMode.Default); ViewModel.ProfilePicture = img_User; btn_camera = new Image { Source="camera.png", WidthRequest=Width/8, HeightRequest=Height/8, HorizontalOptions=LayoutOptions.Start, VerticalOptions = LayoutOptions.Center, BackgroundColor=Xamarin.Forms.Color.Red, }; var Cameratap = new TapGestureRecognizer(OnCameraTapped); btn_camera.IsEnabled = true; btn_camera.GestureRecognizers.Clear(); btn_camera.GestureRecognizers.Add(Cameratap); btn_gallery = new Image { Source="gallery.png", WidthRequest=Width/8, HeightRequest=Height/8, HorizontalOptions=LayoutOptions.End, VerticalOptions = LayoutOptions.Center, BackgroundColor=Xamarin.Forms.Color.Green, }; var Gallerytap = new TapGestureRecognizer(OnGalleryTapped); btn_gallery.IsEnabled = true; btn_gallery.GestureRecognizers.Clear(); btn_gallery.GestureRecognizers.Add(Gallerytap); stack_pop = new StackLayout { HeightRequest = Width / 2, WidthRequest = Width / 2, VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, BackgroundColor = Xamarin.Forms.Color.White, TranslationY=Width / 2, Opacity = 1, Children = { new StackLayout { VerticalOptions = LayoutOptions.Center, HorizontalOptions = LayoutOptions.Center, Orientation = StackOrientation.Horizontal, TranslationY=Width/6, Children= { btn_camera, btn_gallery } } } }; stack_popup = new StackLayout { WidthRequest = Width, HeightRequest = Height, BackgroundColor=Xamarin.Forms.Color.Transparent, Children= { stack_pop } }; image_bg = new Image { WidthRequest = Width, HeightRequest = Height, HorizontalOptions=LayoutOptions.FillAndExpand, VerticalOptions=LayoutOptions.FillAndExpand, Source="bg.png", IsVisible=false }; var PopUpGestureRecognizer = new TapGestureRecognizer { //ViewModel.SelectPictureCommand.Execute(null); Command = new Command (() => { //ViewModel.SelectPictureCommand.Execute(null); var eAndN = new Tuple<Easing, string>[] { new Tuple<Easing, string> (Easing.Linear, "Linear") }; double w = Width; double h = Height; var newPos = new Rectangle(0, h, w, h); var eAndName = eAndN[iClicks]; var easing = eAndName.Item1; stack_popup.LayoutTo(newPos, 80, easing); iClicks %= eAndN.Length; image_bg.IsVisible=false; }), NumberOfTapsRequired = 1 }; stack_popup.GestureRecognizers.Add(PopUpGestureRecognizer); var ProfilePictureGestureRecognizer = new TapGestureRecognizer { //ViewModel.SelectPictureCommand.Execute(null); Command = new Command (() => { var eAndN = new Tuple<Easing, string>[] { new Tuple<Easing, string> (Easing.Linear, "Linear") }; double w = Width; double h = Height; var newPos = new Rectangle(0, 0, w, h); var eAndName = eAndN[iClicks]; var easing = eAndName.Item1; stack_popup.LayoutTo(newPos, 80, easing); iClicks %= eAndN.Length; image_bg.IsVisible=true; }), NumberOfTapsRequired = 1 }; img_User.GestureRecognizers.Add(ProfilePictureGestureRecognizer); txt_Name = new EditText { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, Placeholder="FullName", TextColor=Colors.DarkGray.ToFormsColor(), BackgroundColor=Xamarin.Forms.Color.Transparent, HeightRequest=Width/10, }; txt_Name.SetBinding(Entry.TextProperty, "UserRegInfo.name"); txt_Email = new EditText { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, Keyboard=Keyboard.Email, Placeholder="Email", TextColor=Colors.DarkGray.ToFormsColor(), BackgroundColor=Xamarin.Forms.Color.Transparent, HeightRequest=Width/10 }; txt_Email.SetBinding(Entry.TextProperty, "UserRegInfo.email"); txt_Password = new EditText { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, IsPassword=true, Placeholder="Password", TextColor=Colors.DarkGray.ToFormsColor(), BackgroundColor=Xamarin.Forms.Color.Transparent, HeightRequest=Width/10 }; txt_Password.SetBinding(Entry.TextProperty, "UserRegInfo.password"); picker_Country = new CustomPicker { WidthRequest = Width, HorizontalOptions = LayoutOptions.Center, Title="Location", HeightRequest=Width/10, BackgroundColor=Xamarin.Forms.Color.Transparent, }; picker_Country.SelectedIndexChanged+=((sender, e) => { ViewModel.SelectedIndex=picker_Country.SelectedIndex; }); btn_Submit= new Button { WidthRequest = Width/2, HorizontalOptions = LayoutOptions.Center, HeightRequest=Width/8, Text="Submit", FontSize=17, TextColor=Xamarin.Forms.Color.White, BackgroundColor=Colors.DarkGray.ToFormsColor(), //CommandParameter = 1, Command= ViewModel.RegisterUser, }; stack_TopView = new StackLayout { HorizontalOptions = LayoutOptions.Fill, HeightRequest=Width/3, Padding= new Thickness(0,0,0,Height/45), //BackgroundColor=Color.Blue, Children= { stack_CoverPage,img_User } }; lbl_Expert = new Label { Text="Experts", FontSize=18, TextColor=Colors.DarkGray.ToFormsColor(), FontAttributes=FontAttributes.Bold }; stack_MiddleView = new StackLayout { HorizontalOptions = LayoutOptions.Center, VerticalOptions=LayoutOptions.StartAndExpand, Padding= new Thickness(Width/8,Height/40,Width/8,0), //BackgroundColor=Color.Pink, Spacing=Height/45, Children= { txt_Name,txt_Email,txt_Password,picker_Country,lbl_Expert } }; img_iOS = new Image { WidthRequest=Width/7, HeightRequest=Width/7, HorizontalOptions=LayoutOptions.Start, Source="iOS.png", BackgroundColor=Colors.DarkGray.ToFormsColor(), IsEnabled=false }; var iOStap = new TapGestureRecognizer(OniOSTapped); iOStap.NumberOfTapsRequired = 1; img_iOS.IsEnabled = true; img_iOS.GestureRecognizers.Clear(); img_iOS.GestureRecognizers.Add(iOStap); img_Certified = new Image { WidthRequest=Width/7, HeightRequest=Width/7, HorizontalOptions=LayoutOptions.Center, Source="Certified.png", BackgroundColor=Colors.DarkGray.ToFormsColor(), IsEnabled=false }; var Certifiedtap = new TapGestureRecognizer(OnCertifiedTapped); img_Certified.IsEnabled = true; img_Certified.GestureRecognizers.Clear(); img_Certified.GestureRecognizers.Add(Certifiedtap); img_Android = new Image { WidthRequest=Width/7, HeightRequest=Width/7, HorizontalOptions=LayoutOptions.End, Source="Android.png", BackgroundColor=Colors.DarkGray.ToFormsColor(), IsEnabled=false }; var Androidtap = new TapGestureRecognizer(OnAndroidTapped); Androidtap.NumberOfTapsRequired = 1; img_Android.IsEnabled = true; img_Android.GestureRecognizers.Clear(); img_Android.GestureRecognizers.Add(Androidtap); img_Forms = new Image { WidthRequest=Width/7, HeightRequest=Width/7, HorizontalOptions=LayoutOptions.Start, Source="Forms.png", BackgroundColor=Colors.DarkGray.ToFormsColor(), IsEnabled=false }; var Formstap = new TapGestureRecognizer(OnFormsTapped); img_Forms.IsEnabled = true; img_Forms.GestureRecognizers.Clear(); img_Forms.GestureRecognizers.Add(Formstap); img_Insights = new Image { WidthRequest=Width/7, HeightRequest=Width/7, HorizontalOptions=LayoutOptions.Center, Source="Insight.png", BackgroundColor=Colors.DarkGray.ToFormsColor(), IsEnabled=false }; var Insightstap = new TapGestureRecognizer(OnInsightTapped); img_Insights.IsEnabled = true; img_Insights.GestureRecognizers.Clear(); img_Insights.GestureRecognizers.Add(Insightstap); img_Testcloud = new Image { WidthRequest=Width/7, HeightRequest=Width/7, HorizontalOptions=LayoutOptions.End, Source="TestCloud.png", BackgroundColor=Colors.DarkGray.ToFormsColor(), IsEnabled=false }; var Testcloudtap = new TapGestureRecognizer(OnTestCloudTapped); img_Testcloud.IsEnabled = true; img_Testcloud.GestureRecognizers.Clear(); img_Testcloud.GestureRecognizers.Add(Testcloudtap); stack_FirstExpert = new StackLayout { HorizontalOptions=LayoutOptions.Center, VerticalOptions=LayoutOptions.StartAndExpand, Orientation=StackOrientation.Horizontal, //BackgroundColor=Color.Yellow, Spacing=Height/40, Children= { img_iOS,img_Certified,img_Android } }; stack_SecondExpert = new StackLayout { HorizontalOptions=LayoutOptions.Center, VerticalOptions=LayoutOptions.StartAndExpand, Orientation=StackOrientation.Horizontal, //BackgroundColor=Color.Red, Spacing=Height/40, Children= { img_Forms,img_Insights,img_Testcloud } }; StackLayout stack_MainLayout = new StackLayout { HorizontalOptions = LayoutOptions.StartAndExpand, VerticalOptions=LayoutOptions.Fill, //BackgroundColor=Color.Aqua, Spacing=Width/25, Children= { stack_MiddleView,stack_FirstExpert,stack_SecondExpert,btn_Submit } }; scroll_Main = new ScrollView { HorizontalOptions = LayoutOptions.FillAndExpand, VerticalOptions=LayoutOptions.Start, }; scroll_Main.Content=stack_MainLayout; mainLayout = new StackLayout { HorizontalOptions = LayoutOptions.Fill, VerticalOptions=LayoutOptions.End, BackgroundColor=Xamarin.Forms.Color.White, WidthRequest=Width, HeightRequest=Height, Children = { stack_TopView,scroll_Main } }; rltv_main = new RelativeLayout { WidthRequest = Width, HeightRequest = Height }; rltv_main.Children.Add(mainLayout, Constraint.Constant(0), Constraint.Constant(0),Constraint.Constant(Width),Constraint.Constant(Height)); rltv_main.Children.Add(image_bg, Constraint.Constant(0), Constraint.Constant(0),Constraint.Constant(Width),Constraint.Constant(Height)); rltv_main.Children.Add(stack_popup, Constraint.Constant(0), Constraint.Constant(Height),Constraint.Constant(Width),Constraint.Constant(Height)); this.Content = rltv_main; }
public MyNewNativeCell() { DateTime dt = DateTime.Now; CultureInfo ci = new CultureInfo("en-US"); string sampleDateString = dt.ToString("MMM d", ci); string sampleDateTimeString = dt.ToString("MMM d h:mm tt", ci); //Also above can be done more formally like this: //https://msdn.microsoft.com/en-us/library/cc165448.aspx var prayerAction = new MenuItem { Text = "Delete", IsDestructive = true }; prayerAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); prayerAction.Clicked += async(sender, e) => { var mi = ((MenuItem)sender); Debug.WriteLine("More Context Action clicked: " + ((SurveyQuestion)mi.CommandParameter).SharedText); await App.Service.DeleteSurveyQuestionAsync((SurveyQuestion)mi.CommandParameter); AppConstants.NeedsUpdating = true; MessagingCenter.Send <object> (this, "RefreshData"); //AT THE CONTACTS PAGE LEVEL - NEED TO RUN :: PostDeleteActions (); }; var thoughtAction = new MenuItem { Text = "T&P" }; //, IsDestructive = true }; // red background thoughtAction.SetBinding(MenuItem.CommandParameterProperty, new Binding(".")); thoughtAction.Clicked += async(sender, e) => { var mi = ((MenuItem)sender); System.Random random = new Random(); string randomNumber = string.Join(string.Empty, Enumerable.Range(0, 10).Select(number => random.Next(0, 5).ToString())); ThinkingOfYou oneThinkingOfYou = new ThinkingOfYou() { theId = randomNumber, FirstName = "TestFirst", LastName = "TestLast", FullName = AppConstants.FBFullName, SharedText = String.Format("{0} is thinking of you!", AppConstants.FBFullName), NewText = "Test NewText", FBProfileUrl = AppConstants.FullURLPlusFBIdentityID, CreateDateString = sampleDateString, CreateDateTimeString = sampleDateTimeString, //public string "WE NEED THE ID OF THE PRAYER REQUEST" //i.e. each prayer request needs an ID //THEN on the page, we want to filter by that ID thePrayerRequestId = ((SurveyQuestion)mi.CommandParameter).Id, theFBID = AppConstants.FBIdentityID, }; await App.Service.AddOrUpdateThinkingOfYouAsync(oneThinkingOfYou); //App.Service.SynchronizeQuestionsAsync (oneSurveyQuestion.Id); //AppConstants.NeedsUpdating == false; AppConstants.NeedsUpdating = true; MessagingCenter.Send <object> (this, "RefreshData"); }; // add to the ViewCell's ContextActions property ContextActions.Add(prayerAction); ContextActions.Add(thoughtAction); label = new Label { VerticalTextAlignment = TextAlignment.Center }; label.SetBinding(Label.TextProperty, "SharedText"); tempLabel = new Label { VerticalTextAlignment = TextAlignment.Center }; tempLabel.SetBinding(Label.TextProperty, "FBProfileUrl"); localFBString = String.Format("http://graph.facebook.com/165706980572556/picture?type=normal"); //{0}/picture?type=normal", tempLabel.Text); //if (tempLabel.Text != null) //{ // localFBString = String.Format ("http://graph.facebook.com/{0}/picture?type=normal", tempLabel.Text); //} //else //{ // localFBString = String.Format ("http://graph.facebook.com/165706980572555/picture?type=normal", tempLabel.Text); //} //IMAGES - BOXES var profileImage = new Image { //Source = ImageSource.FromUri (new Uri("http://graph.facebook.com/165706980572556/picture?type=normal")) // Source = ImageSource.FromUri (new Uri (localFBString)) //Source = localFBString }; profileImage.SetBinding(Image.SourceProperty, "FBProfileUrl"); // profileImage.SetBinding (Image.SourceProperty, "FullURIFBProfileUrl"); //IMAGES - CIRLCE-BOXES var circleProfileImage = new CircleImage { //Source = ImageSource.FromUri (new Uri("http://graph.facebook.com/165706980572556/picture?type=normal")) // Source = ImageSource.FromUri (new Uri (localFBString)) //Source = localFBString BorderColor = Color.White, BorderThickness = 3, HeightRequest = 59, WidthRequest = 59, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center }; circleProfileImage.SetBinding(Image.SourceProperty, "FBProfileUrl"); // profileImage.SetBinding (Image.SourceProperty, "FullURIFBProfileUrl"); dateLabel = new Label { FontAttributes = FontAttributes.Italic, FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Label)), TextColor = Color.Gray }; dateLabel.SetBinding(Label.TextProperty, "CreateDateString"); //Need a date and time data point (simple) - let's just do (month & year) Nov 9th //string URLNormal = String.Format ("http://graph.facebook.com/{0}/picture?type=normal", _profileId); //string URLSquare = String.Format ("http://graph.facebook.com/{0}/picture?type=square", _profileId); //string URLSmall = String.Format ("http://graph.facebook.com/{0}/picture?type=small", _profileId); //string fullNameString = AppConstants.FBFullName; //Label fullNameLabel = new Label (); //fullNameLabel.Text = fullNameString; //var webImage = new Image { Aspect = Aspect.AspectFit }; //webImage.Source = ImageSource.FromUri (new Uri (URLLarge)); ////webImage.Source = ImageSource.FromUri (new Uri ("https://xamarin.com/content/images/pages/forms/example-app.png")); ////webImage.Source = ImageSource.FromUri (new Uri ("http://graph.facebook.com/v2.2/423402/picture")); //var webImage2 = new Image { Aspect = Aspect.AspectFit }; //webImage2.Source = ImageSource.FromUri (new Uri (URLNormal));//new Uri ("http://graph.facebook.com/423402/picture?type=large")); var imageStackLayout = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 0, 0, 0), //HorizontalOptions = LayoutOptions.StartAndExpand, Children = { circleProfileImage } //profileImage } // label, dateLabel } //Children = { firstName, label } }; var text = new StackLayout { Orientation = StackOrientation.Vertical, Padding = new Thickness(0, 0, 0, 0), HorizontalOptions = LayoutOptions.StartAndExpand, Children = { label, dateLabel } }; layout = new StackLayout { Padding = new Thickness(10, 10, 5, 10), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.StartAndExpand, Children = { imageStackLayout, text } // profileImage, text }//, dateLabel}//, dateLabel } //, fav } }; View = layout; }
public VetCell() { var vetProfileImage = new CircleImage { BorderColor = App.BrandColor, BorderThickness = 2, HeightRequest = 50, WidthRequest = 50, Aspect = Aspect.AspectFill, HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Center, }; vetProfileImage.SetBinding(Image.SourceProperty, "ImageSource"); var nameLabel = new Label() { FontFamily = "HelveticaNeue-Medium", FontSize = 18, TextColor = Color.Black }; nameLabel.SetBinding(Label.TextProperty, "Name"); var distanceLabel = new Label() { FontAttributes = FontAttributes.Bold, FontSize = 12, TextColor = Color.FromHex("#666") }; distanceLabel.SetBinding( Label.TextProperty, new Binding( "Distance", stringFormat: "{0} Miles Away") ); // Online image and label var onlineImage = new Image() { Source = "online.png", HeightRequest = 8, WidthRequest = 8 }; onlineImage.SetBinding(Image.IsVisibleProperty, "ShouldShowAsOnline"); var onLineLabel = new Label() { Text = "Online", TextColor = App.BrandColor, FontSize = 12, }; onLineLabel.SetBinding(Label.IsVisibleProperty, "ShouldShowAsOnline"); // Offline image and label var offlineImage = new Image() { Source = "offline.png", HeightRequest = 8, WidthRequest = 8 }; offlineImage.SetBinding(Image.IsVisibleProperty, "ShouldShowAsOffline"); var offLineLabel = new Label() { Text = "5 hours ago", TextColor = Color.FromHex("#ddd"), FontSize = 12, }; offLineLabel.SetBinding(Label.IsVisibleProperty, "ShouldShowAsOffline"); // Vet rating label and star image var starLabel = new Label() { FontSize = 12, TextColor = Color.Gray }; starLabel.SetBinding(Label.TextProperty, "Stars"); var starImage = new Image() { Source = "star.png", HeightRequest = 12, WidthRequest = 12 }; var ratingStack = new StackLayout() { Spacing = 3, Orientation = StackOrientation.Horizontal, Children = { starImage, starLabel } }; var statusLayout = new StackLayout { Orientation = StackOrientation.Horizontal, Children = { distanceLabel, onlineImage, onLineLabel, offlineImage, offLineLabel } }; var vetDetailsLayout = new StackLayout { Padding = new Thickness(10, 0, 0, 0), Spacing = 0, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { nameLabel, statusLayout, ratingStack } }; var tapImage = new Image() { Source = "tap.png", HorizontalOptions = LayoutOptions.End, HeightRequest = 12, }; var cellLayout = new StackLayout { Spacing = 0, Padding = new Thickness(10, 5, 10, 5), Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.FillAndExpand, Children = { vetProfileImage, vetDetailsLayout, tapImage } }; this.View = cellLayout; }
public void Init() { VM.BindData(); var editJaktBtn = new Image() { Source = "more.png", HeightRequest = 40, WidthRequest = 40, HorizontalOptions = LayoutOptions.EndAndExpand }; var dateLabel = new Label() { FontSize = 12 }; var titleLabel = new Label() { FontSize = 16 }; var circleImage = new CircleImage() { VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.Start, BorderThickness = 2, BorderColor = Color.White, HeightRequest = 70, WidthRequest = 70, Aspect = Aspect.AspectFill }; var headerTextLayout = new StackLayout() { VerticalOptions = LayoutOptions.CenterAndExpand, HorizontalOptions = LayoutOptions.StartAndExpand, Children = { dateLabel, titleLabel } }; dateLabel.SetBinding(Label.TextProperty, new Binding("CurrentJakt.DatoFraTil")); titleLabel.SetBinding(Label.TextProperty, new Binding("CurrentJakt.Title")); circleImage.SetBinding(CircleImage.SourceProperty, new Binding("CurrentJakt.Image")); headerTextLayout.SetBinding(StackLayout.IsVisibleProperty, new Binding("IsLoadingPosition", converter: new InverseBooleanConverter())); PositionActivityIndicator.SetBinding(ActivityIndicator.IsVisibleProperty, new Binding("IsLoadingPosition")); var jaktSummary = new StackLayout() { Orientation = StackOrientation.Horizontal, HorizontalOptions = LayoutOptions.Fill, Padding = 5, GestureRecognizers = { new TapGestureRecognizer { Command = new Command(() => Navigation.PushAsync(new JaktPage(VM.CurrentJakt))), }, }, Children = { circleImage, headerTextLayout, PositionActivityIndicator, editJaktBtn } }; ListView lv = new ListView(); lv.HorizontalOptions = LayoutOptions.FillAndExpand; lv.VerticalOptions = LayoutOptions.FillAndExpand; lv.SetBinding(ListView.ItemsSourceProperty, new Binding("ItemCollection")); lv.ItemSelected += (sender, e) => { if (e.SelectedItem != null) { Navigation.PushAsync(new LoggPage((Logg)e.SelectedItem), true); ((ListView)sender).SelectedItem = null; } }; //Remember to remove this event handler on dispoing of the page; DataTemplate dt = new DataTemplate(typeof(CircleImageCell)); dt.SetBinding(CircleImageCell.TextProperty, new Binding("Title")); dt.SetBinding(CircleImageCell.DetailProperty, new Binding("Details")); dt.SetBinding(CircleImageCell.ImageSourceProperty, new Binding("Image")); lv.ItemTemplate = dt; if (VM.ItemCollection.Any()) { Content = new StackLayout() { Padding = 5, Children = { jaktSummary, lv } }; } else { var btn = new Button() { Text = "Opprett første loggføring", BackgroundColor = Color.FromHex("#74B058") }; btn.Clicked += delegate(object sender, EventArgs args) { var logg = VM.CreateLogg(); Navigation.PushAsync(new LoggPage(logg), true); }; Content = new StackLayout() { Children = { jaktSummary, btn } }; } }
private void InitializeComponent() { if (ResourceLoader.ResourceProvider != null && ResourceLoader.ResourceProvider(typeof(MinePage).GetTypeInfo().Assembly.GetName(), "Views/MinePage.xaml") != null) { this.__InitComponentRuntime(); return; } if (XamlLoader.XamlFileProvider != null && XamlLoader.XamlFileProvider(base.GetType()) != null) { this.__InitComponentRuntime(); return; } RowDefinition rowDefinition = new RowDefinition(); RowDefinition rowDefinition2 = new RowDefinition(); RowDefinition rowDefinition3 = new RowDefinition(); BindingExtension bindingExtension = new BindingExtension(); Image image = new Image(); BindingExtension bindingExtension2 = new BindingExtension(); CircleImage circleImage = new CircleImage(); BindingExtension bindingExtension3 = new BindingExtension(); Label label = new Label(); BindingExtension bindingExtension4 = new BindingExtension(); Label label2 = new Label(); StackLayout stackLayout = new StackLayout(); AbsoluteLayout absoluteLayout = new AbsoluteLayout(); Frame frame = new Frame(); BindingExtension bindingExtension5 = new BindingExtension(); DataTemplate dataTemplate = new DataTemplate(); ListView listView = new ListView(); Frame frame2 = new Frame(); TranslateExtension translateExtension = new TranslateExtension(); BindingExtension bindingExtension6 = new BindingExtension(); Button button = new Button(); Grid grid = new Grid(); ScrollView scrollView = new ScrollView(); BindingExtension bindingExtension7 = new BindingExtension(); BindingExtension bindingExtension8 = new BindingExtension(); ActivityIndicator activityIndicator = new ActivityIndicator(); Grid grid2 = new Grid(); NameScope nameScope = new NameScope(); NameScope.SetNameScope(this, nameScope); NameScope.SetNameScope(grid2, nameScope); NameScope.SetNameScope(scrollView, nameScope); NameScope.SetNameScope(grid, nameScope); NameScope.SetNameScope(rowDefinition, nameScope); NameScope.SetNameScope(rowDefinition2, nameScope); NameScope.SetNameScope(rowDefinition3, nameScope); NameScope.SetNameScope(frame, nameScope); NameScope.SetNameScope(absoluteLayout, nameScope); NameScope.SetNameScope(image, nameScope); NameScope.SetNameScope(stackLayout, nameScope); NameScope.SetNameScope(circleImage, nameScope); NameScope.SetNameScope(label, nameScope); NameScope.SetNameScope(label2, nameScope); NameScope.SetNameScope(frame2, nameScope); NameScope.SetNameScope(listView, nameScope); ((INameScope)nameScope).RegisterName("listview", listView); if (listView.StyleId == null) { listView.StyleId = "listview"; } NameScope.SetNameScope(button, nameScope); NameScope.SetNameScope(activityIndicator, nameScope); this.listview = listView; this.SetValue(NavigationPage.HasNavigationBarProperty, false); grid.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(10.0)); grid.SetValue(Grid.RowSpacingProperty, 10.0); rowDefinition.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto")); grid.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition); rowDefinition2.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto")); grid.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition2); rowDefinition3.SetValue(RowDefinition.HeightProperty, new GridLengthTypeConverter().ConvertFromInvariantString("Auto")); grid.GetValue(Grid.RowDefinitionsProperty).Add(rowDefinition3); frame.SetValue(Grid.RowProperty, 0); frame.SetValue(Frame.HasShadowProperty, false); frame.SetValue(Frame.CornerRadiusProperty, 10f); frame.SetValue(VisualElement.BackgroundColorProperty, Color.Black); frame.SetValue(Frame.BorderColorProperty, Color.Black); frame.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(0.0)); absoluteLayout.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(0.0)); absoluteLayout.SetValue(View.HorizontalOptionsProperty, LayoutOptions.FillAndExpand); absoluteLayout.SetValue(View.VerticalOptionsProperty, LayoutOptions.FillAndExpand); image.SetValue(Image.AspectProperty, Aspect.AspectFill); bindingExtension.Path = "Background"; BindingBase binding = ((IMarkupExtension <BindingBase>)bindingExtension).ProvideValue(null); image.SetBinding(Image.SourceProperty, binding); image.SetValue(AbsoluteLayout.LayoutBoundsProperty, new Rectangle(0.0, 0.0, 1.0, 1.0)); image.SetValue(AbsoluteLayout.LayoutFlagsProperty, AbsoluteLayoutFlags.All); absoluteLayout.Children.Add(image); stackLayout.SetValue(VisualElement.BackgroundColorProperty, Color.Transparent); stackLayout.SetValue(AbsoluteLayout.LayoutBoundsProperty, new Rectangle(0.5, 0.5, -1.0, -1.0)); stackLayout.SetValue(AbsoluteLayout.LayoutFlagsProperty, AbsoluteLayoutFlags.PositionProportional); bindingExtension2.Path = "UserIcon"; BindingBase binding2 = ((IMarkupExtension <BindingBase>)bindingExtension2).ProvideValue(null); circleImage.SetBinding(Image.SourceProperty, binding2); circleImage.SetValue(VisualElement.HeightRequestProperty, 80.0); circleImage.SetValue(VisualElement.WidthRequestProperty, 80.0); circleImage.SetValue(Image.AspectProperty, Aspect.AspectFit); stackLayout.Children.Add(circleImage); label.SetValue(Label.TextColorProperty, Color.White); BindableObject bindableObject = label; BindableProperty fontSizeProperty = Label.FontSizeProperty; IExtendedTypeConverter extendedTypeConverter = new FontSizeConverter(); string value = "Large"; XamlServiceProvider xamlServiceProvider = new XamlServiceProvider(); Type typeFromHandle = typeof(IProvideValueTarget); object[] array = new object[0 + 8]; array[0] = label; array[1] = stackLayout; array[2] = absoluteLayout; array[3] = frame; array[4] = grid; array[5] = scrollView; array[6] = grid2; array[7] = this; xamlServiceProvider.Add(typeFromHandle, new SimpleValueTargetProvider(array, Label.FontSizeProperty)); xamlServiceProvider.Add(typeof(INameScopeProvider), new NameScopeProvider { NameScope = nameScope }); Type typeFromHandle2 = typeof(IXamlTypeResolver); XmlNamespaceResolver xmlNamespaceResolver = new XmlNamespaceResolver(); xmlNamespaceResolver.Add("", "http://xamarin.com/schemas/2014/forms"); xmlNamespaceResolver.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml"); xmlNamespaceResolver.Add("circle", "clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin"); xmlNamespaceResolver.Add("layout", "clr-namespace:RFID.Layout"); xmlNamespaceResolver.Add("local", "clr-namespace:RFID"); xamlServiceProvider.Add(typeFromHandle2, new XamlTypeResolver(xmlNamespaceResolver, typeof(MinePage).GetTypeInfo().Assembly)); xamlServiceProvider.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(25, 62))); bindableObject.SetValue(fontSizeProperty, extendedTypeConverter.ConvertFromInvariantString(value, xamlServiceProvider)); bindingExtension3.Path = "Name"; BindingBase binding3 = ((IMarkupExtension <BindingBase>)bindingExtension3).ProvideValue(null); label.SetBinding(Label.TextProperty, binding3); label.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Center")); stackLayout.Children.Add(label); label2.SetValue(Label.TextColorProperty, Color.White); BindableObject bindableObject2 = label2; BindableProperty fontSizeProperty2 = Label.FontSizeProperty; IExtendedTypeConverter extendedTypeConverter2 = new FontSizeConverter(); string value2 = "Medium"; XamlServiceProvider xamlServiceProvider2 = new XamlServiceProvider(); Type typeFromHandle3 = typeof(IProvideValueTarget); object[] array2 = new object[0 + 8]; array2[0] = label2; array2[1] = stackLayout; array2[2] = absoluteLayout; array2[3] = frame; array2[4] = grid; array2[5] = scrollView; array2[6] = grid2; array2[7] = this; xamlServiceProvider2.Add(typeFromHandle3, new SimpleValueTargetProvider(array2, Label.FontSizeProperty)); xamlServiceProvider2.Add(typeof(INameScopeProvider), new NameScopeProvider { NameScope = nameScope }); Type typeFromHandle4 = typeof(IXamlTypeResolver); XmlNamespaceResolver xmlNamespaceResolver2 = new XmlNamespaceResolver(); xmlNamespaceResolver2.Add("", "http://xamarin.com/schemas/2014/forms"); xmlNamespaceResolver2.Add("x", "http://schemas.microsoft.com/winfx/2009/xaml"); xmlNamespaceResolver2.Add("circle", "clr-namespace:ImageCircle.Forms.Plugin.Abstractions;assembly=ImageCircle.Forms.Plugin"); xmlNamespaceResolver2.Add("layout", "clr-namespace:RFID.Layout"); xmlNamespaceResolver2.Add("local", "clr-namespace:RFID"); xamlServiceProvider2.Add(typeFromHandle4, new XamlTypeResolver(xmlNamespaceResolver2, typeof(MinePage).GetTypeInfo().Assembly)); xamlServiceProvider2.Add(typeof(IXmlLineInfoProvider), new XmlLineInfoProvider(new XmlLineInfo(26, 62))); bindableObject2.SetValue(fontSizeProperty2, extendedTypeConverter2.ConvertFromInvariantString(value2, xamlServiceProvider2)); bindingExtension4.Path = "Introduce"; BindingBase binding4 = ((IMarkupExtension <BindingBase>)bindingExtension4).ProvideValue(null); label2.SetBinding(Label.TextProperty, binding4); label2.SetValue(Label.HorizontalTextAlignmentProperty, new TextAlignmentConverter().ConvertFromInvariantString("Center")); stackLayout.Children.Add(label2); absoluteLayout.Children.Add(stackLayout); frame.SetValue(ContentView.ContentProperty, absoluteLayout); grid.Children.Add(frame); frame2.SetValue(Frame.OutlineColorProperty, Color.White); frame2.SetValue(Grid.RowProperty, 1); frame2.SetValue(Frame.CornerRadiusProperty, 5f); frame2.SetValue(VisualElement.BackgroundColorProperty, Color.White); frame2.SetValue(Frame.BorderColorProperty, new Color(0.87058824300765991, 0.87058824300765991, 0.87058824300765991, 1.0)); frame2.SetValue(Xamarin.Forms.Layout.PaddingProperty, new Thickness(0.0)); listView.SetValue(ListView.RowHeightProperty, 50); listView.SetValue(VisualElement.HeightRequestProperty, 203.0); listView.SetValue(ListView.SeparatorColorProperty, new Color(0.87058824300765991, 0.87058824300765991, 0.87058824300765991, 1.0)); listView.SetValue(ListView.SeparatorVisibilityProperty, SeparatorVisibility.Default); listView.ItemSelected += this.ListView_ItemSelected; bindingExtension5.Path = "MenuSource"; BindingBase binding5 = ((IMarkupExtension <BindingBase>)bindingExtension5).ProvideValue(null); listView.SetBinding(ItemsView <Cell> .ItemsSourceProperty, binding5); IDataTemplate dataTemplate2 = dataTemplate; MinePage.< InitializeComponent > _anonXamlCDataTemplate_1 <InitializeComponent> _anonXamlCDataTemplate_ = new MinePage.< InitializeComponent > _anonXamlCDataTemplate_1(); object[] array3 = new object[0 + 7]; array3[0] = dataTemplate; array3[1] = listView; array3[2] = frame2; array3[3] = grid; array3[4] = scrollView; array3[5] = grid2; array3[6] = this;
/// <summary> /// Method that creates the page content /// </summary> public View SetContent() { var emblem = new Image { HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, HeightRequest = 160 }; emblem.SetBinding(Image.SourceProperty, UploadingViewModel.EmblemProperty); var spinner = new CircleImage { Source = "Resources/spinner.gif", HorizontalOptions = LayoutOptions.Center, VerticalOptions = LayoutOptions.Start, }; spinner.SetBinding(Image.SourceProperty, UploadingViewModel.SpinnerProperty); var text = new Label { TextColor = Color.FromHex(Definitions.DefaultTextColor), FontSize = Definitions.HeaderFontSize - 12, HorizontalOptions = LayoutOptions.CenterAndExpand, YAlign = TextAlignment.Center, }; text.SetBinding(Label.TextProperty, UploadingViewModel.UploaderTextProperty); text.SetBinding(Label.IsVisibleProperty, UploadingViewModel.UploadingTextVisibilityProperty); var img = new Image { HeightRequest = 120, WidthRequest = 120, HorizontalOptions = LayoutOptions.Center, }; img.SetBinding(Image.RotationProperty, UploadingViewModel.RotateProperty); img.SetBinding(Image.SourceProperty, UploadingViewModel.SpinnerProperty); img.SetBinding(Image.IsVisibleProperty, UploadingViewModel.UploadingSpinnerVisibilityProperty); var loadingStack = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), VerticalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(0, 20, 0, 0), Spacing = 60, Children = { img, text, } }; var layout = new StackLayout { Orientation = StackOrientation.Vertical, BackgroundColor = Color.FromHex(Definitions.BackgroundColor), VerticalOptions = LayoutOptions.FillAndExpand, HorizontalOptions = LayoutOptions.FillAndExpand, Padding = new Thickness(10, 70, 10, 10), Children = { emblem, loadingStack, ErrorStack(), } }; return layout; }