Пример #1
0
        private async void PopulateContacts()
        {
            var vm = (MainViewModel)this.BindingContext;
            await vm.HydrateContactsMainViewModel();

            this.Contacts.HasUnevenRows     = true;
            this.Contacts.ItemsSource       = vm.Contacts;
            this.Contacts.WidthRequest      = ((Page)this).Width * 7 / 8;
            this.Contacts.HeightRequest     = ((Page)this).Height * 2 / 3;
            this.ContactsBG.WidthRequest    = ((Page)this).Width * 7 / 8;
            this.ContactsBG.HeightRequest   = ((Page)this).Height * 10 / 25;
            this.Contacts.HorizontalOptions = LayoutOptions.Center;
            this.Contacts.ItemTapped       += (s, e) => Navigation.PushModalAsync(
                new ContactDetailView
            {
                ContactDetailsVm = new ContactDetailsViewModel(
                    ((ListView)
                     s).SelectedItem as Contact)
            }, false);
            this.Contacts.ItemTemplate = new DataTemplate(() =>
            {
                var what = new ImageCell();
                what.SetBinding(ImageCell.TextProperty, "Name");
                what.SetBinding(ImageCell.ImageSourceProperty, "PicUrl");
                what.SetBinding(ImageCell.DetailProperty, "Phone");
                vm.IsBusy = false;
                return(what);
            });
        }
Пример #2
0
        public MainMenuPage()
        {
            listView = new ListView()
            {
                ItemsSource  = PopulateMenu(),
                ItemTemplate = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            Padding = new Thickness(0, 40, 0, 0);
            Icon    = "hamburger.png";
            Title   = "Stratedge.me Monitor";

            Content = new StackLayout()
            {
                Children =
                {
                    listView
                },
                VerticalOptions = LayoutOptions.FillAndExpand
            };
        }
Пример #3
0
        void SetImage(ImageCell cell, CellTableViewCell target)
        {
            var source = cell.ImageSource;

            target.ImageView.Image = null;

            source.LoadImage(cell.FindMauiContext(), (result) =>
            {
                var uiimage = result.Value;
                if (uiimage != null)
                {
                    NSRunLoop.Main.BeginInvokeOnMainThread(() =>
                    {
                        if (target.Cell != null)
                        {
                            target.ImageView.Image = uiimage;
                            target.SetNeedsLayout();
                        }
                        else
                        {
                            uiimage?.Dispose();
                        }
                    });
                }
            });
        }
Пример #4
0
        public GalleryPage()
        {
            Title       = "Gallery";
            ImageModels = new List <Image>();
            for (var i = 0; i < 7337; i++)
            {
                var a = new Image
                {
                    Title = Guid.NewGuid().ToString(), ImagePath = "cat.png"
                };
                ImageModels.Add(a);
            }

            var listView = new ListView(ListViewCachingStrategy.RecycleElement)
            {
                HasUnevenRows = true,
                ItemsSource   = ImageModels,
                ItemTemplate  = new DataTemplate(() =>
                {
                    var imageCell = new ImageCell {
                        TextColor = Color.Black, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnItemTapped;
            Content              = new StackLayout {
                Children = { listView }
            };
        }
Пример #5
0
        public PitaniePage()
        {
            InitializeComponent();
            Pitanie = new List <Sport>
            {
                new Sport {
                    Title = "ICONFIT BCAA 2:1:1, 400g", Title1 = "\nВысококачественный аминокислотный комплекс с разветвленной цепью с более высоким " +
                                                                 "содержанием аминокислот, чем у большинства конкурирующих продуктов.", Company = "IconFit", Price = "16€", ImagePath = "bcaa.jpg"
                },
                new Sport {
                    Title = "Protein.Buzz Whey Isolate 2000g", Title1 = "\nВ 1 порции:\n -20. 8 г белка (обогащенный ВСАА и L-глютамином)" +
                                                                        "\n- низкое содержание жира и только 1 г углеводов \n- без сахара \n- без аспартама", Company = "Protein.Buzz", Price = "47€", ImagePath = "prbuzz.jpg"
                },
                new Sport {
                    Title = "Optimum Nutrition 100% Gold Standard Casein 1,8kg", Title1 = "24 грамма высококачественного, укрепленного энзимами " +
                                                                                          "антикатаболический мицеллярный казеин 10 грамм BCAA, глютамина в одной мерной ложке Улучшенный AMINOGEN", Company = "Optimum Nutrition", Price = "62€", ImagePath = "gs.jpg"
                },
                new Sport {
                    Title = "SAN 100% Pure Titanium Whey, 2.27kg", Title1 = "100% Pure Titanium Whey был создан для того, чтобы максимально" +
                                                                            " противодействовать послетренировочному катаболизму " +
                                                                            "(разрушению мышц), а его анаболическое действие длится ДО 4 ЧАСОВ.", Company = "SAN", Price = "49€", ImagePath = "san.jpg"
                },
                new Sport {
                    Title = "Mutant Mass, 2270g", Title1 = "Mutant Mass — супермощный гейнер для набора мышечной массы, " +
                                                           "обеспечивающий максимальный рост мышечной массы и полноценное восстановление после тренировок в течение всего дня..."
                    , Company = "Mutant", Price = "23€", ImagePath = "mut.jpg"
                }
            };
            Label header = new Label
            {
                Text      = "Лучшее За свою цену",
                FontSize  = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                TextColor = Color.White
            };
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Pitanie,
                // Определяем формат отображения данных
                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.White, DetailColor = Color.White
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Title");
                    Binding companyBinding = new Binding {
                        Path = "Price", StringFormat = "цена:{0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, companyBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnItemTapped;
            this.Content         = new StackLayout {
                Children = { header, listView }
            };
            this.BackgroundColor = Color.Black;
        }
Пример #6
0
		async void SetImage(ImageCell cell, CellTableViewCell target)
		{
			var source = cell.ImageSource;

			target.ImageView.Image = null;

			IImageSourceHandler handler;

			if (source != null && (handler = Registrar.Registered.GetHandler<IImageSourceHandler>(source.GetType())) != null)
			{
				UIImage uiimage;
				try
				{
					uiimage = await handler.LoadImageAsync(source).ConfigureAwait(false);
				}
				catch (TaskCanceledException)
				{
					uiimage = null;
				}

				NSRunLoop.Main.BeginInvokeOnMainThread(() =>
				{
					target.ImageView.Image = uiimage;
					target.SetNeedsLayout();
				});
			}
			else
				target.ImageView.Image = null;
		}
Пример #7
0
        void SetImage(ImageCell cell, CellTableViewCell target)
        {
            var source = cell.ImageSource;

#pragma warning disable CA1416 // TODO: 'UITableViewCell.ImageView' is unsupported on: 'ios' 14.0 and later
            target.ImageView.Image = null;

            source.LoadImage(cell.FindMauiContext(), (result) =>
            {
                var uiimage = result.Value;
                if (uiimage != null)
                {
                    NSRunLoop.Main.BeginInvokeOnMainThread(() =>
                    {
                        if (target.Cell != null)
                        {
                            target.ImageView.Image = uiimage;
                            target.SetNeedsLayout();
                        }
                        else
                        {
                            uiimage?.Dispose();
                        }
                    });
                }
            });
#pragma warning restore CA1416
        }
Пример #8
0
        private void Foo()
        {
            ImageCell cell = new ImageCell
            {
                ImageSource = null,
                Text        = "hello ",
            };

            Page p = new Page
            {
                //BackgroundColor = "white",
            };

            var l = new Label
            {
                Font = Font.SystemFontOfSize(NamedSize.Micro),
            };

            var e = new Entry()
            {
                Keyboard        = Keyboard.Numeric,
                VerticalOptions = LayoutOptions.FillAndExpand,
            };


            var c = new ContentView()
            {
                Padding = new Thickness(5),
            };

            var sl = new StackLayout
            {
                Padding = new Thickness(5),
            };
        }
Пример #9
0
        async void SetImage(ImageCell cell, CellTableViewCell target)
        {
            var source = cell.ImageSource;

#pragma warning disable CA1416 // TODO: 'UITableViewCell.ImageView' is unsupported on: 'ios' 14.0 and later
            target.ImageView.Image = null;

            var uiimage = await source.GetNativeImageAsync().ConfigureAwait(false);

            if (uiimage != null)
            {
                NSRunLoop.Main.BeginInvokeOnMainThread(() =>
                {
                    if (target.Cell != null)
                    {
                        target.ImageView.Image = uiimage;
                        target.SetNeedsLayout();
                    }
                    else
                    {
                        uiimage?.Dispose();
                    }
                });
            }
#pragma warning restore CA1416
        }
Пример #10
0
        void LoadFiles(string folder)
        {
            if (!Directory.Exists(folder))
            {
                Directory.CreateDirectory(folder);
            }

            File.Create(Config.GetFilePath("test.lua"));
            //File.WriteAllText(Path.Combine(folder, "test.lua"), "print(1)");
            File.Create(Config.GetFilePath("test2.lua"));

            fileList.Root = new TableRoot();

            TableSection section = new TableSection("Documents");

            string[] filenames = Directory.GetFiles(folder, "*.lua", SearchOption.TopDirectoryOnly);
            for (int i = filenames.Length - 1; i >= 0; --i)
            {
                ImageCell cell  = new ImageCell();
                int       index = i;
                cell.Tapped += (s, e) => { LoadFile(filenames[index]); };
                cell.Text    = Path.GetFileName(filenames[i]);
                cell.Detail  = $"{new FileInfo(filenames[i]).Length} bytes";


                section.Add(cell);
            }
            fileList.Root.Add(section);
        }
Пример #11
0
 public SignaturePickerViewModel(Template selectedTemplate)
 {
     SelectedTemplate = selectedTemplate;
     SignatureItems   = new ImageCell[]
     {
         // Creating a few signatures for testing purposes
         new ImageCell()
         {
             ImageSource = "donaldtrump.png",
             Text        = "Donald Trump",
             Detail      = "President"
         },
         new ImageCell()
         {
             ImageSource = "gavinbelson.png",
             Text        = "Gavin Belson",
             Detail      = "Visionary behind 'The box 3'"
         },
         new ImageCell()
         {
             ImageSource = "waltdisney.png",
             Text        = "Walt Disney",
             Detail      = "Interesting"
         }
     };
 }
Пример #12
0
        //Manipulate image cells to remove menu option from default images
        private void OnBindingContextChanged(object sender, EventArgs e)
        {
            base.OnBindingContextChanged();

            if (BindingContext == null)
            {
                return;
            }

            ImageCell theImageCell = ((ImageCell)sender);
            Image     item         = theImageCell.BindingContext as Image;

            if (item == null)
            {
                return;
            }

            int item_type = Int32.Parse(item.Type);

            //For 4 default images remove menu is not added
            if (item_type < 5)
            {
                theImageCell.ContextActions.RemoveAt(3);
            }
        }
Пример #13
0
        public ListView mainListT()
        {
            List <ViewCell> reportList = new List <ViewCell>();

            ListView     listView     = new ListView();
            DataTemplate dataTemplate = new DataTemplate(typeof(ImageCell));

            listView.ItemTemplate = dataTemplate;

            ImageCell cell1 = new ImageCell();

            cell1.Text        = "ONLINE REPORTING";
            cell1.Detail      = "Classic Posda";
            cell1.ImageSource = ImageSource.FromFile("linearrow.png");
            cell1.TextColor   = Color.Black;
            cell1.DetailColor = Color.Default;
            cell1.Height      = 100;
            ImageCell cell2 = new ImageCell();

            cell2.Text        = "LOCATION ANALYSIS";
            cell2.Detail      = "Store, Mall Analysis";
            cell2.ImageSource = ImageSource.FromFile("gauge2.png");
            cell2.TextColor   = Color.Black;
            cell2.DetailColor = Color.Default;
            cell2.Height      = 100;

            //reportList.Add();



            listView.ItemsSource = reportList;

            return(listView);
        }
Пример #14
0
        async void SetImage(ImageCell cell, CellTableViewCell target)
        {
            var source = cell.ImageSource;

            target.ImageView.Image = null;

            IImageSourceHandler handler;

            if (source != null && (handler = Registrar.Registered.GetHandler <IImageSourceHandler>(source.GetType())) != null)
            {
                UIImage uiimage;
                try
                {
                    uiimage = await handler.LoadImageAsync(source).ConfigureAwait(false);
                }
                catch (TaskCanceledException)
                {
                    uiimage = null;
                }

                NSRunLoop.Main.BeginInvokeOnMainThread(() =>
                {
                    target.ImageView.Image = uiimage;
                    target.SetNeedsLayout();
                });
            }
            else
            {
                target.ImageView.Image = null;
            }
        }
Пример #15
0
        private void ShowDetail(object sender, EventArgs e)
        {
            ImageCell cell    = (ImageCell)sender;
            var       context = (MovieViewModel)cell.BindingContext;

            Navigation.PushAsync(new MovieDetail(context.Id));
        }
Пример #16
0
        private void GetOptions()
        {
            var mock = new AppMetadataRepositoryMockup();
            List <EPMServices.MainMenuOption> options = new List <EPMServices.MainMenuOption> ();

            mock.setOptions(ref options);
            List <Cell> cells = new List <Cell> ();

            foreach (var option in options)
            {
                ImageCell cell = new ImageCell()
                {
                    Text             = option.Title,
                    ImageSource      = option.Img,
                    CommandParameter = option.ContainerId,
                    Command          = GoToMenuOptionCommand,
                    TextColor        = Color.Black
                };

                cells.Add(cell);
            }

            TableSection table = this.FindByName <TableSection> ("mainTableSection");

            table.Add(cells);
        }
Пример #17
0
        public CalendarPage()
        {
            Notes = new List <notes>
            {
                new notes {
                    MoodName = "Чудово", Emotions = "Радість, Натхнення", Activities = "Малювання", ImagePath = "awsome.png"
                },
                new notes {
                    MoodName = "Добре", Emotions = "Задоволення", Activities = "Робота", ImagePath = "good.png"
                },
            };

            InitializeComponent();
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Notes,
                // Определяем формат отображения данных
                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.Red, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "MoodName");
                    Binding emBinding = new Binding {
                        Path = "Emotions", StringFormat = "Флагман от компании {0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, emBinding);

                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };
        }
Пример #18
0
        private void update()
        {
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = BagCoffee,
                // Определяем формат отображения данных
                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.Red, DetailColor = Color.Green
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Title");
                    Binding companyBinding = new Binding {
                        Path = "Price", StringFormat = "Цена:  {0}"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, companyBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "ImagePath");
                    return(imageCell);
                })
            };

            listView.ItemTapped += OnItemTapped;
            this.Content         = new StackLayout {
                Children = { header, back, listView, stackLayout, address, cart, btn_сonfirmation }
            };
        }
Пример #19
0
        //user select an image
        private async void ThumbImage_MouseLeftButtonUp(object sender, MouseButtonEventArgs e)
        {
            if (e.OriginalSource is Polygon)
            {
                //clicked on favorite
                e.Handled = true;
                return;
            }
            _clickedPictureCell = (ImageCell)sender;
            //prevent clicking on empty cells
            if (!_clickedPictureCell.HasSource)
            {
                return;
            }
            _isCancelable = false;
            Curtain.CurtainDown();
            Curtain.StartLoadingAnimation();
            Curtain.PreviewImage.SetData(_clickedPictureCell.Data);
            _clickedPictureCell.Data.DownloadProgressChanged += (s, args) => { Curtain.AnimateProgressBar(args); };
            RaiseThumbClicked();
            var resolutions = await _clickedPictureCell.Data.GetResolutions().ConfigureAwait(false);

            if (resolutions == null)
            {
                //MessageBox.Show("Operation failed, please try another picture or contact maker.",
                //    "Something happened", MessageBoxButton.OK);
                UiInvoke(Curtain.ShowError);
            }
            else
            {
                UiInvoke(() => Curtain.ShowResolutionLabels(resolutions));
            }
            UiInvoke(Curtain.StopLoadingAnimation);
            _isCancelable = true;
        }
Пример #20
0
        static async Task SetImage(ImageCell cell, CellView target)
        {
            var source = cell.ImageSource;

            target.ImageView.Source = null;

            IImageSourceHandler handler;

            if (source != null && (handler =
                                       Registrar.Registered.GetHandler <Renderers.IImageSourceHandler>(source.GetType())) != null)
            {
                string image;
                try
                {
                    image = await handler.LoadImageAsync(source).ConfigureAwait(false);
                }
                catch (TaskCanceledException)
                {
                    image = null;
                }

                target.ImageView.Source = image;
            }
            else
            {
                target.ImageView.Source = null;
            }
        }
Пример #21
0
        public MenuPage()
        {
            InitializeComponent();

            MenuPageViewModel menuPageViewModel = new MenuPageViewModel();

            BindingContext = menuPageViewModel;

            lstOptions              = new ListView();
            lstOptions.ItemsSource  = menuPageViewModel.Options;
            lstOptions.ItemTemplate = new DataTemplate(() => {
                var imageCell = new ImageCell();
                imageCell.SetBinding(TextCell.TextProperty, "optionName");
                imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                return(imageCell);
            });
            lstOptions.VerticalOptions     = LayoutOptions.FillAndExpand;
            lstOptions.SeparatorVisibility = SeparatorVisibility.None;

            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        = { lstOptions }
            };
        }
Пример #22
0
        static async Task SetImage(ImageCell cell, CellNSView target)
        {
            var source = cell.ImageSource;

            target.ImageView.Image = null;

            IImageSourceHandler handler;

            if (source != null && (handler = Internals.Registrar.Registered.GetHandlerForObject <IImageSourceHandler>(source)) != null)
            {
                NSImage uiimage;
                try
                {
                    uiimage = await handler.LoadImageAsync(source).ConfigureAwait(false);
                }
                catch (TaskCanceledException)
                {
                    uiimage = null;
                }

                NSRunLoop.Main.BeginInvokeOnMainThread(() =>
                {
                    target.ImageView.Image = uiimage;
                    target.NeedsLayout     = true;
                });
            }
            else
            {
                target.ImageView.Image = null;
            }
        }
Пример #23
0
        private void CreateTemplate()
        {
            var builder = ApplicationContext.CreateGcMultirowTemplateBuilder(ColorContext, allowHorizontalResize: false);
            var height  = builder.DefaultRowHeight;

            var imgCell = new ImageCell();

            imgCell.SupportsAnimation = true;
            imgCell.Selectable        = false;

            builder.Items.AddRange(new CellSetting[]
            {
                new CellSetting(height, 40, "Icon", cell: imgCell),
                new CellSetting(height, 200, "Text"),
                new CellSetting(height, 200, "TimeStamp")
            });
            var template = builder.Build();

            foreach (var header in template.ColumnHeaders)
            {
                header.Visible = false;
            }

            grid.Template   = template;
            grid.ScrollBars = ScrollBars.Vertical;
            grid.SplitMode  = SplitMode.None;
            grid.TabStop    = false;
        }
Пример #24
0
        private async void orMenuList_Tapped(object sender, EventArgs e)
        {
            ImageCell img = new ImageCell();

            img = (ImageCell)sender;
            //03101201631012016
            getReport(g.user.sesid, img.Detail, "0", g.datePeriod.ToString(), img.Text);
        }
Пример #25
0
 public PatientListPage(ObservableCollection <Patient> patients)
 {
     InitializeComponent();
     //linking Xaml link variables to Xaml objects
     this.patientList             = this.FindByName <ListView>("Patients");
     this.patientImage            = this.FindByName <ImageCell>("PatientPicture");
     this.patientList.ItemsSource = patients;
 }
Пример #26
0
        public override UICollectionViewCell GetCell(UICollectionView collectionView, NSIndexPath indexPath)
        {
            ImageCell imageCell = (ImageCell)collectionView.DequeueReusableCell(cellId, indexPath);

            imageCell.UpdateImage(monkeys [indexPath.Row].ImageFile);

            return(imageCell);
        }
Пример #27
0
        View CreateContent(ImageCell cell)
        {
            XForm.Label text = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
                FontAttributes          = FontAttributes.Bold,
            };
            XForm.Label detailLabel = new XForm.Label
            {
                HorizontalTextAlignment = TextAlignment.Start,
                VerticalTextAlignment   = TextAlignment.Start,
                HorizontalOptions       = LayoutOptions.FillAndExpand,
                VerticalOptions         = LayoutOptions.FillAndExpand,
            };
            detailLabel.FontSize = Device.GetNamedSize(NamedSize.Micro, detailLabel);

            text.SetBinding(XForm.Label.TextProperty, new Binding("Text", source: cell));
            text.SetBinding(XForm.Label.TextColorProperty, new Binding("TextColor", source: cell));

            detailLabel.SetBinding(XForm.Label.TextProperty, new Binding("Detail", source: cell));
            detailLabel.SetBinding(XForm.Label.TextColorProperty, new Binding("DetailColor", source: cell));

            XForm.Image image = new XForm.Image
            {
                HeightRequest     = Element.ItemHeight,
                WidthRequest      = Element.ItemWidth,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                VerticalOptions   = LayoutOptions.FillAndExpand,
                Aspect            = Aspect.Fill
            };
            image.SetBinding(XForm.Image.SourceProperty, new Binding("ImageSource", source: cell));

            var view = new AbsoluteLayout();

            view.Children.Add(image, new XForm.Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);
            view.Children.Add(new StackLayout
            {
                VerticalOptions   = LayoutOptions.EndAndExpand,
                HorizontalOptions = LayoutOptions.FillAndExpand,
                Children          =
                {
                    new StackLayout {
                        VerticalOptions   = LayoutOptions.EndAndExpand,
                        HorizontalOptions = LayoutOptions.FillAndExpand,
                        Padding           = 15,
                        Spacing           = 0,
                        BackgroundColor   = XForm.Color.FromHex("#2b7c87"),
                        Children          = { text, detailLabel }
                    }
                }
            }, new XForm.Rectangle(0, 0, 1, 1), AbsoluteLayoutFlags.All);

            cell.SetBinding(GridView.BindingContextProperty, new Binding("BindingContext", source: view));
            return(view);
        }
Пример #28
0
        private void Selected(ImageCell cell)
        {
            var item = MeChatHost.MeChat.UserProfileHost.UserProfiles.Find((x) => x.Name == cell.Text);

            Navigation.PushAsync(new ProfilePage(item)
            {
                Title = "Profile"
            }, true);
        }
Пример #29
0
        public MasterPage()
        {
            var masterPageItems = new List <MasterPageItem>();

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "Profile",
                IconSource = "avatar.png",
                TargetType = typeof(ProfilePage)
            });

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "AlexandruP",
                IconSource = "avatar.png",
                TargetType = typeof(AlexandruP)
            });

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "AndradaH",
                IconSource = "avatar.png",
                TargetType = typeof(AndradaH)
            });

            masterPageItems.Add(new MasterPageItem
            {
                Title      = "VladO",
                IconSource = "avatar.png",
                TargetType = typeof(VladO)
            });

            listView = new ListView
            {
                ItemsSource  = masterPageItems,
                ItemTemplate = new DataTemplate(() => {
                    var imageCell = new ImageCell();
                    imageCell.SetBinding(TextCell.TextProperty, "Title");
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "IconSource");
                    return(imageCell);
                }),
                VerticalOptions     = LayoutOptions.FillAndExpand,
                SeparatorVisibility = SeparatorVisibility.None
            };

            Padding = new Thickness(20, 20, 20, 20);
            Icon    = "avatar.png";
            Title   = "MicrosoftJam";
            Content = new StackLayout
            {
                VerticalOptions = LayoutOptions.FillAndExpand,
                Children        =
                {
                    listView
                }
            };
        }
        public MainPage()
        {
            Persones = new List <Person>
            {
                new Person {
                    Name = "Alex1", Image = "Alex1.jpg", Number = "+3753334350"
                },
                new Person {
                    Name = "Alex2", Image = "Alex2.jpg", Number = "+3753334351"
                },
                new Person {
                    Name = "Alex3", Image = "Alex3.jpg", Number = "+3753334352"
                },
                new Person {
                    Name = "Alex4", Image = "Alex4.jpg", Number = "+3753334353"
                },
                new Person {
                    Name = "Alex5", Image = "Alex5.jpg", Number = "+3753334354"
                },
                new Person {
                    Name = "Alex6", Image = "Alex6.jpg", Number = "+3753334355"
                }
            };

            Label header = new Label
            {
                Text              = "Список контактов",
                FontSize          = Device.GetNamedSize(NamedSize.Large, typeof(Label)),
                HorizontalOptions = LayoutOptions.Center
            };
            ListView listView = new ListView
            {
                HasUnevenRows = true,
                ItemsSource   = Persones,

                ItemTemplate = new DataTemplate(() =>
                {
                    ImageCell imageCell = new ImageCell {
                        TextColor = Color.Black, DetailColor = Color.Black
                    };
                    imageCell.SetBinding(ImageCell.TextProperty, "Name");

                    Binding numberBinding = new Binding {
                        Path = "Number"
                    };
                    imageCell.SetBinding(ImageCell.DetailProperty, numberBinding);
                    imageCell.SetBinding(ImageCell.ImageSourceProperty, "Image");
                    return(imageCell);
                })
            };

            listView.ItemSelected += OnListViewItemSelected;
            this.Content           = new StackLayout {
                Children = { header, listView }
            };
        }
Пример #31
0
        static void SetImage(ImageCell cell, CellNSView target)
        {
            target.ImageView.Image = null;

            _ = cell.ApplyNativeImageAsync(ImageCell.ImageSourceProperty, image =>
            {
                target.ImageView.Image = image;
                target.NeedsLayout     = true;
            });
        }
Пример #32
0
		public void TestBindingContextPropagationOnImageCell ()
		{
			var context = new object ();
			var cell = new ImageCell ();
			cell.BindingContext = context;
			var source = new FileImageSource ();
			cell.ImageSource = source;
			Assert.AreSame (context, source.BindingContext);

			cell = new ImageCell ();
			source = new FileImageSource ();
			cell.ImageSource = source;
			cell.BindingContext = context;
			Assert.AreSame (context, source.BindingContext);
		}
Пример #33
0
		public ImageCellTablePage ()
		{
			Title = "ImageCell Table Gallery - Legacy";

			Device.OnPlatform (iOS: () => {
				if (Device.Idiom == TargetIdiom.Tablet) {
					Padding = new Thickness (0, 0, 0, 60);
				}
			});

			var tableSection = new TableSection ("Section One") {
				new ImageCell { Text = "Text 1", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 2", Detail = "Detail 1", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 3", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 4", Detail = "Detail 2", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 5", ImageSource = new FileImageSource { File = "oasis.jpg" } },
				new ImageCell { Text = "Text 6", Detail = "Detail 3", ImageSource = new FileImageSource { File = "oasis.jpg" } },
				new ImageCell { Text = "Text 7", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 8", Detail = "Detail 4", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 9", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 10", Detail = "Detail 5", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 11", ImageSource = new FileImageSource { File = "oasis.jpg" } },
				new ImageCell { Text = "Text 12", Detail = "Detail 6", ImageSource = new FileImageSource { File = "oasis.jpg" } },
			};

			ImageCell imageCell = null;
			imageCell = new ImageCell { 
				Text = "not tapped",
				ImageSource = "oasis.jpg",
				Command = new Command(()=>{
					imageCell.Text = "tapped";
					(imageCell.ImageSource as FileImageSource).File = "crimson.jpg";
				})
			};
			var tableSectionTwo = new TableSection ("Section Two") {
				new ImageCell { Text = "Text 13", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 14", Detail = "Detail 7", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 15", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 16", Detail = "Detail 8", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 17", ImageSource = new FileImageSource { File = "oasis.jpg" } },
				new ImageCell { Text = "Text 18", Detail = "Detail 9", ImageSource = new FileImageSource { File = "oasis.jpg" } },
				new ImageCell { Text = "Text 19", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 20", Detail = "Detail 10", ImageSource = new FileImageSource { File = "crimson.jpg" } },
				new ImageCell { Text = "Text 21", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 22", Detail = "Detail 11", ImageSource = new FileImageSource { File = "cover1.jpg" } },
				new ImageCell { Text = "Text 23", ImageSource = new FileImageSource { File = "oasis.jpg" } },
				new ImageCell { Text = "Text 24", Detail = "Detail 12", ImageSource = new FileImageSource { File = "oasis.jpg" } },
				imageCell,
			};

			var root = new TableRoot ("Text Cell table") {
				tableSection,
				tableSectionTwo
			};

			var table = new TableView {
				Root = root,
			};

			Content = table;
		}