コード例 #1
0
        private async void LoadData()
        {
            await ItemImageView.BindImageViewAsync(Product);

            ItemTitleLabel.Text       = (Product.Name ?? string.Empty).ToUpper();
            ItemDescriptionLabel.Text = Product.Description;

            var smallAttributes = new UIStringAttributes
            {
                Font = UIFont.FromName(ItemPriceLabel.Font.Name, 20f)
            };

            string priceStr = "SEK" + Product.Price.ToString("0.00");
            NSMutableAttributedString mutablePriceStr = new NSMutableAttributedString(priceStr);

            mutablePriceStr.SetAttributes(smallAttributes.Dictionary, new NSRange(0, 3));
            mutablePriceStr.SetAttributes(smallAttributes.Dictionary, new NSRange(priceStr.Length - 3, 3));

            ItemPriceLabel.AttributedText = mutablePriceStr;
        }
コード例 #2
0
        public async void Bind(SaleItem saleItem)
        {
            await ItemImageView.BindImageViewAsync(saleItem);

            ItemNameLabel.Text        = !string.IsNullOrEmpty(saleItem.Name) ? saleItem.Name.ToUpperInvariant() : string.Empty;
            ItemDescriptionLabel.Text = saleItem.Description;

            var smallAttributes = new UIStringAttributes
            {
                Font = UIFont.FromName(ItemPriceLabel.Font.Name, 10f)
            };

            string priceStr = "$" + Math.Round(saleItem.Price);
            NSMutableAttributedString mutablePriceStr = new NSMutableAttributedString(priceStr);

            mutablePriceStr.SetAttributes(smallAttributes.Dictionary, new NSRange(0, 1));

            ItemPriceLabel.AttributedText = mutablePriceStr;
            ItemId = saleItem.Id;
        }
コード例 #3
0
        public async void Bind(Product Product)
        {
            await ItemImageView.BindImageViewAsync(Product);

            ItemSupplierLabel.Text    = !string.IsNullOrEmpty(Product.Supplier.Name) ? Product.Supplier.Name.ToUpperInvariant() : string.Empty;
            ItemNameLabel.Text        = !string.IsNullOrEmpty(Product.Name) ? Product.Name.ToUpperInvariant() : string.Empty;
            ItemDescriptionLabel.Text = !string.IsNullOrEmpty(Product.Description) ? Product.Description : "Beskrivning saknas";

            //var smallAttributes = new UIStringAttributes
            //{
            //    Font = UIFont.FromName(ItemPriceLabel.Font.Name, 10f)
            //};

            //string priceStr = "$" + Math.Round(Product.Price);
            //NSMutableAttributedString mutablePriceStr = new NSMutableAttributedString(priceStr);

            //mutablePriceStr.SetAttributes(smallAttributes.Dictionary, new NSRange(0, 1));

            //ItemPriceLabel.AttributedText = mutablePriceStr;
            ItemId = Product.Id;
        }