Quantcast
Channel: Xamarin.Forms — Xamarin Community Forums
Viewing all 91519 articles
Browse latest View live

FontSize Problem

$
0
0

Hi all,

I created a custom renderer fo adjust size of my label to a screen.

It's works good for 4 label but for the fifth label i have a problem, like u can see on this screen :

but they have a same value for the font size like u can see here :

i don't understand why they don't have the same display.

Any one have an idea ? Or it's bug ?

Thanks in advance .


FFimageLoading SVG

$
0
0

Hi all and specially @DanielL ,

I have problem with SVG, so i have created CacheImage on Xaml like this :

<ffimageloading:CachedImage x:Name="mapimg" Grid.Row="5" Grid.Column="3" Grid.ColumnSpan="2"/>

And i have put source like this :

`using FFImageLoading.Svg.Forms;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

using Xamarin.Forms;

namespace Mu
{
public partial class CustomModuleCell : ViewCell
{
public CustomModuleCell()
{
InitializeComponent();

        mapimg.Source = SvgImageSource.FromResource("Mu.Resources.Drawables.LocalisationOver.svg");

    }
}`

but it's not works and visual studio offers me this :

So i think it have a problem but i don't know what. If i put an ImageSource with png file it's works but no with SvgImageSource with svg image.

And my svg is an Embedded Resource.

So i don't know what it's not works, if any one can help me, i accept .

Thanks in advance.

Map API Key

$
0
0

I am trying to create a Map app and I get a black screen. I get the controls (the target bullseye, zoom in/out, and google label) but no map. I think it has to do with the API key but I dont know. I have been banging my head over this one.

Why UIMenuController doesn't work anymore after displaying a Xamarin Forms Page ?

$
0
0

Hi,

I have a UIMenuController that appear when a longpress is performed on a UIView.
This menu contains 2 items :
Item 1 : open a native iOS UIViewController
Item 2 : open a Xamarin Forms Page with the CreateViewController() method

In the second case when the Xamarin Forms Page is dismissed the menu doesn't appear anymore.
It's only the case when I try to display the Xamarin Forms page, if I select only the item 1 the menu still works.

I tried to put some logs in order to find out the issue.
When the longpress event is processing the menu is well created.
Then the canBecomeFirstResponder return true.
But it seems the canPerformAction method is not call anymore.

XAML Localization not working

$
0
0

Hi! I have no experience in Xamain, so maybe my question is dumb, but here it is:

I use the https://developer.xamarin.com/guides/cross-platform/xamarin-forms/localization/ link to setup localization in my app. And it is working when I localize in code. But in XAML I have the following problem. I wrote the Localization class in Android, that looks like this:

  public class Localize : Localization.ILocalize {
        public System.Globalization.CultureInfo GetCurrentCultureInfo() {
            var androidLocale = Java.Util.Locale.Default;
            var netLanguage = androidLocale.ToString().Replace( "_", "-" ); // turns pt_BR into pt-BR
            return new System.Globalization.CultureInfo( netLanguage );
        }
    }

But when I try to build, it shows me the following message:
Error CS0012 The type 'CultureInfo' is defined in an assembly that is not referenced. You must add a reference to assembly 'System.Globalization, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a'. WinGymAndroid.Droid C:\Projects\Xamarin\WinGymAndroid\WinGymAndroid\WinGymAndroid.Droid\Localize.cs

My ILocalize interface is:
public interface ILocalize {
CultureInfo GetCurrentCultureInfo();
}

This is Xamarin.Forms project. My platform is: Windows 10, Visual Studio 2015 with installed Xamarin.

Receive image from other apps

$
0
0

what is the best way to implement a share target app for kind jpg png?

How to Handle Push notifications?

$
0
0

I receives notifications when app is in foreground and in background. But not receiving a push notification when I remove it from the recent screen/Task manager.

How to push notification to specific users in Xamarin.Forms Android ?

$
0
0

I have Implemented push notification in xamarin.forms android using this but it sends the notification to all the device.I want to send notification to the specific users only.How can I achieve it ?


iOS image renderer null data exception

$
0
0

I am retreiving images from an AWS S3 storage. The download is successful as the image is appearing as a teaser.
I am binding a tap gesture to each teaser to go to another page, which displays the image at full size. However on page construction im getting a System.ArgumentNullException, "Value can not be null. Paramater name: Data"

The same page template works fine when taking pictures and previewing before upload, so im assuming its a garbage collection/file storage issue.
Ive tried saving the images statically after download, but that isnt working.
Below is my code, if anyone can suggest a better way to store the images on download that would be great :)

Stack Trace:

at UIKit.UIImage.LoadFromData (Foundation.NSData data, nfloat scale) [0x0000c] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/src/build/ios/native/UIKit/UIImage.g.cs:593
  at Xamarin.Forms.Platform.iOS.StreamImagesourceHandler+<LoadImageAsync>d__0.MoveNext () [0x000a8] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\ImageRenderer.cs:190
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at System.Runtime.CompilerServices.TaskAwaiter.ThrowForNonSuccess (System.Threading.Tasks.Task task) [0x00047] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:187
  at System.Runtime.CompilerServices.TaskAwaiter.HandleNonSuccessAndDebuggerNotification (System.Threading.Tasks.Task task) [0x0002e] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:156
  at System.Runtime.CompilerServices.TaskAwaiter.ValidateEnd (System.Threading.Tasks.Task task) [0x0000b] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:128
 at System.Runtime.CompilerServices.TaskAwaiter1[TResult].GetResult ()in/Users/builder/data/lanes/3539/f37444ae/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/TaskAwaiter.cs:357
  at Xamarin.Forms.Platform.iOS.ImageRenderer+<SetImage>d__7.MoveNext () [0x000dd] in C:\BuildAgent\work\aad494dc9bc9783\Xamarin.Forms.Platform.iOS\Renderers\ImageRenderer.cs:131
--- End of stack trace from previous location where exception was thrown ---
  at System.Runtime.ExceptionServices.ExceptionDispatchInfo.Throw () [0x0000c] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/exceptionservices/exceptionservicescommon.cs:143
  at System.Runtime.CompilerServices.AsyncMethodBuilderCore.<ThrowAsync>m__0 (System.Object state) [0x00000] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/_build/Library/Frameworks/Xamarin.iOS.framework/Versions/git/src/mono/external/referencesource/mscorlib/system/runtime/compilerservices/AsyncMethodBuilder.cs:1018
  at UIKit.UIKitSynchronizationContext+<Post>c__AnonStorey0.<>m__0 () [0x00000] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/src/UIKit/UIKitSynchronizationContext.cs:24
  at Foundation.NSAsyncActionDispatcher.Apply () [0x00000] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/src/Foundation/NSAction.cs:163
  at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr)
  at UIKit.UIApplication.Main (System.String[] args, IntPtr principal, IntPtr delegate) [0x00005] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/src/UIKit/UIApplication.cs:79
  at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/3539/f37444ae/source/maccore/src/UIKit/UIApplication.cs:63
  at MrQuickie.iOS.Application.Main (System.String[] args) [0x00008] in /Users/bensutter/Documents/Dev/Mirk/MrQuickie/iOS/Main.cs:17

AWS S3 Download:

public async Task<ImageSource> downloadItem(string key)
        {
            ImageSource temp;
            GetObjectRequest request = new GetObjectRequest
            {
                BucketName = Constants.Constants.BUCKET_NAME,
                Key = key,
            };
            var image = await s3Client.GetObjectAsync(request);
            using (GetObjectResponse response = image)
            using (Stream responseStream = response.ResponseStream)
            {
                Stream memoryStream = new MemoryStream(ReadFully(responseStream));
                temp = ImageSource.FromStream(() => { return memoryStream; });
            }
            return temp;
        }

Page OnAppearing() that calls the download:

var source = await App.s3client.downloadItem(key.Value);
    teaser = new Teaser
    {
        Source = source,
        Aspect = Aspect.AspectFill,
        WidthRequest = 50,
        HeightRequest = 50,
        Index = i,
    };
    string imageKey = job.id + "_" + i;
    imageContainer.Children.Add(teaser);
    App.tempJobPictures.Add(imageKey, teaser);
    var imageTapRecognizer = new TapGestureRecognizer();
    imageTapRecognizer.Tapped += async (sender, e) =>
    {
        await Navigation.PushAsync(new EnlargeImageOverviewPage(imageKey, i));
    };
    teaser.GestureRecognizers.Add(imageTapRecognizer);

Best way to initialize Commands

$
0
0

Hi,

so far I always implemented Commands as public properties and initialized them in my Constructor like this:

    public class MainMenuPageModel : FreshBasePageModel
    {
        public MainMenuPageModel()
        {
            OpenRecipesCommand = new Command(async () => await CoreMethods.PushPageModel<RecipesMainPageModel>());

        }

        public Command OpenRecipesCommand { get; private set; }
   }

No I stumbled upon this solution:

    public Command AddContact {
        get {
            return new Command (async () => {
                await CoreMethods.PushPageModel<ContactPageModel> ();
            });
        }
    }

Is there any advantages/disadvantages in this solutions?

Cheers
Thomas

Missing storyboard nib file when compiling with Debug

$
0
0

I cannot compile with debugging info, it fails with:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets: error : System.IO.FileNotFoundException:
/path/to/project/obj/iPhone/Debug/build-iphone8.1-10.0.1/ibtool-link/LaunchScreen.storyboardc/5-view-6.nib does not exist
File name: '/path/to/project/obj/iPhone/Debug/build-iphone8.1-10.0.1/ibtool-link/LaunchScreen.storyboardc/5-view-6.nib'

Any idea what I should do? Compiling as Release works fine (incl. provisioning).

Android keyboard and the ContentPage view collapsing/expanding issue w/ Material Design

$
0
0

Hi, after I upgraded to 1.5.1 and getting material design in place, my app is working and looking great in Android. HOWEVER the view when focussing or unfoccusing the keyboard does not work as expected.

I have a Grid with icons at the bottom of my ContentPage. So when the keyboard expands the Grid should be sitting on top of the keyboard and the Editor shrinking in height to accomodate. As mentioned this worked before the Material Design update.

I am using the IosKeyboardFixPageRenderer from http://stackoverflow.com/questions/31172518/how-do-i-keep-the-keyboard-from-covering-my-ui-instead-of-resizing-it/31172519 for iOS and it works great.

How do I fix this on Android with Material Design?

Thank you

Changed FontFamily of button to default, why?

$
0
0

Hello, I want to set Font attributes and Font size when button is clicked and restore font attributes,size other button in layout to default, but after changing font size or attributes, family setting to default, and after this font family I can`t change.

First use of set font (worked):

  public Schedule()
                {
                   .....
                    foreach (Button day in slWeek.Children)
                    {
                        Device.OnPlatform(iOS: () => { day.FontFamily = "NotoSerif-Regular"; },
                            Android: () => { CustomFontEffect.SetFontFileName(day, "NotoSerif-Regular"); },
                            WinPhone: () => { day.FontFamily = "/Assets/Fonts/NotoSerif-Regular.ttf#NotoSerif-Regular"; }
                    );
                        day.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Button));
                        day.FontAttributes = FontAttributes.None;
    ....

event of click:

            private void BtnWeek_Clicked(object sender, EventArgs e)
            {
                var btn = (sender as Button);
                foreach (Button day in slWeek.Children)
                {
                    if (day.BackgroundColor == Color.Gray)
                    {
                        day.FontAttributes = FontAttributes.None;
                        day.FontSize = Device.GetNamedSize(NamedSize.Small, typeof(Button));
                        day.BackgroundColor = Color.FromRgba(204, 204, 204, 255);
                    }
                }
                btn.FontAttributes = FontAttributes.Bold;
                btn.FontSize = Device.GetNamedSize(NamedSize.Medium, typeof(Button));
                btn.BackgroundColor = Color.Gray;
            }

XAML Definition

                <StackLayout x:Name="slWeek" Orientation="Horizontal" HeightRequest="50" BackgroundColor="Gray" Spacing="0" Padding="0,0,0,0" Margin="0,0,0,0">
                   <Button Style="{StaticResource buttonWeekStyle}" Clicked="BtnWeek_Clicked" Text="{l10n:Translate Monday}"></Button>
                    <Button Style="{StaticResource buttonWeekStyle}" Clicked="BtnWeek_Clicked" Text="{l10n:Translate Tuesday}"></Button>
                    <Button Style="{StaticResource buttonWeekStyle}" Clicked="BtnWeek_Clicked" Text="{l10n:Translate Wednesday}"></Button>
                    <Button Style="{StaticResource buttonWeekStyle}" Clicked ="BtnWeek_Clicked" Text="{l10n:Translate Thursday}"></Button>
                    <Button Style="{StaticResource buttonWeekStyle}"  Clicked ="BtnWeek_Clicked" Text="{l10n:Translate Friday}"></Button>
                    <Button Style="{StaticResource buttonWeekStyle}"  Clicked ="BtnWeek_Clicked" Text="{l10n:Translate Saturday}"></Button>
                    <Button Style="{StaticResource buttonWeekStyle}"  Clicked ="BtnWeek_Clicked" Text="{l10n:Translate Sanday}"></Button>
              </StackLayout>

XAML Style

                <Style x:Key="buttonWeekStyle" TargetType="Button">
                    <Setter Property="BackgroundColor" Value="#CCCCCC" />
                    <Setter Property="Margin" Value="-5,-10,0,-10"></Setter>
                    <Setter Property="HorizontalOptions" Value="Fill"></Setter>
                </Style>

Example:
After loading page:
image
When I click on button:
image
After click on other button:
image
(see different Monday and Tuesday)

I tried to set Font Family after click but nothing has changed
P.S. Sorry for my English

Laggy/slow animation when changing view

$
0
0

The animation when changing view is somewhat sluggish. Atm I'm using the Genymotion emulator but I've tried on a Galaxy S2 as well and the results were similar..

Any suggestions on what could/should be done differently?

Here is the code:

`

    using System;
    using System.ComponentModel;
    using System.Windows.Input;
    using Xamarin.Forms;

    namespace Testing
    {
public class TestViewModel : BaseViewModel // BaseViewModel is basically empty atm
{

    ICommand  btnTestCommand;

    public ICommand BtnTestCommand
    {
        get { return btnTestCommand; }
        set
        {
            if (btnTestCommand == value)
                return;
            btnTestCommand = value;
            OnPropertyChanged ();
        }
    }
    public TestViewModel ()
    {
        BtnTestCommand = new Command (() => {
            Navigation.PushAsync(new TestView(new TestViewModel()));
        }
        );

    }
}

}

    using System;
    using Xamarin.Forms;

    namespace Testing
    {
public class TestView : ContentPage
{
    public TestView (BaseViewModel basemodel)
    {

        BindingContext = basemodel;
        basemodel.Navigation = Navigation;

        NavigationPage.SetHasNavigationBar (this, true);

        var stack = new StackLayout {
            Orientation = StackOrientation.Vertical,
            Padding = new Thickness(0, 25, 0, 25)
        };

        Label header = new Label
        {
            Text = "MyHeader",
            TextColor = Color.FromHex("00ff00"),
            //Font = Font.BoldSystemFontOfSize(25),
            HorizontalOptions = LayoutOptions.Center
        };

        Label lblA = new Label
        {
            Text = "lblA",
            TextColor = Color.FromHex("00ff00"),
            //Font = Font.BoldSystemFontOfSize(25),
            HorizontalOptions = LayoutOptions.Center
        };

        Label lblB = new Label
        {
            Text = "lblB",
            TextColor = Color.FromHex("00ff00"),
            Font = Font.BoldSystemFontOfSize(25),
            HorizontalOptions = LayoutOptions.Center
        };

        var btnTest = new Button {
            Text = "MyButton",
            BackgroundColor = Color.FromHex ("ff0000"),
            TextColor = Color.White,
            HorizontalOptions = LayoutOptions.Center,
            VerticalOptions = LayoutOptions.Start,
            WidthRequest=200,
        };

        btnTest.SetBinding (Button.CommandProperty, "BtnTestCommand");

        stack.Children.Add (header);
        stack.Children.Add (btnTest);
        stack.Children.Add (lblA);
        stack.Children.Add (lblB);
        Content = stack;


    }
}

}
`

How use x:Reference/Path for binding in XAML

$
0
0

Hello,

I have a content page with a x:Name property (=HomePage).
I have in this contentpage a listview with a x:Name property (=LV_Detachments).

I'm trying to bind in XAML the IsVisible property of LV_Detachments like this:

            <BoxView.Triggers>
                <DataTrigger TargetType="BoxView" Binding="{Binding Source={x:Reference HomePage}, Path=BindingContext.LV_Detachments.IsVisible}" Value="True">
                    <Setter Property="BackgroundColor" Value="White"/>
                </DataTrigger>
                <DataTrigger TargetType="BoxView" Binding="{Binding Source={x:Reference HomePage}, Path=BindingContext.LV_Detachments.IsVisible}" Value="False">
                    <Setter Property="BackgroundColor" Value="Red"/>
                </DataTrigger>
            </BoxView.Triggers>

But it's not work :(

Best regards


System.TypeInitializationException error when using NavigationPage

$
0
0

I'm on Xamarin.Forms version 2.3.2.127.

Anytime I seem to wrap my content pages in a NavigationPage I get the following error:

"System.TypeInitializationException: The type initializer for 'Attribute' threw an exception."

Even using something as simple will throwthe error, such as:

protected override void OnStart()
        {
            MainPage = new NavigationPage(new SimplePage());
        }

Where simplePage is:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
             xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
             x:Class="SimpleApp.SimplePage">
  <Label Text="{Binding MainText}" VerticalOptions="Center" HorizontalOptions="Center" />
</ContentPage>

namespace SimpleApp
{
    public partial class SimplePage : ContentPage
    {
        public test()
        {
            InitializeComponent();
        }
    }
}

Any help is appreciated, I'm not really sure how to proceed from here.

Creating Weekly based DataGrid in xamarin.forms

$
0
0

Hi,
Currently i trying to create weekly date datagrid. Each column will be date and each row will be different tasks. in that i want to access each cell when i click cell the foreground color will be changed. How achieve this kind of datagrid. Here i have attached my screenshot.

Xamarin.Forms Bindable Picker

$
0
0

If anyone wonders how to make a Bindable Picker, here's the code:

`

public class BindablePicker : Picker
{
    #region Fields

    //Bindable property for the items source
    public static readonly BindableProperty ItemsSourceProperty =
        BindableProperty.Create<BindablePicker, IEnumerable>(p => p.ItemsSource, null, propertyChanged: OnItemsSourcePropertyChanged);

    //Bindable property for the selected item
    public static readonly BindableProperty SelectedItemProperty =
        BindableProperty.Create<BindablePicker, object>(p => p.SelectedItem, null, BindingMode.TwoWay, propertyChanged: OnSelectedItemPropertyChanged);

    #endregion

    #region Properties

    /// <summary>
    /// Gets or sets the items source.
    /// </summary>
    /// <value>
    /// The items source.
    /// </value>
    public IEnumerable ItemsSource
    {
        get { return (IEnumerable)GetValue(ItemsSourceProperty); }
        set { SetValue(ItemsSourceProperty, value); }
    }

    /// <summary>
    /// Gets or sets the selected item.
    /// </summary>
    /// <value>
    /// The selected item.
    /// </value>
    public object SelectedItem
    {
        get { return GetValue(SelectedItemProperty); }
        set { SetValue(SelectedItemProperty, value); }
    }

    #endregion

    #region Methods

    /// <summary>
    /// Called when [items source property changed].
    /// </summary>
    /// <param name="bindable">The bindable.</param>
    /// <param name="value">The value.</param>
    /// <param name="newValue">The new value.</param>
    private static void OnItemsSourcePropertyChanged(BindableObject bindable, IEnumerable value, IEnumerable newValue)
    {
        var picker = (BindablePicker)bindable;
        var notifyCollection = newValue as INotifyCollectionChanged;
        if (notifyCollection != null)
        {
            notifyCollection.CollectionChanged += (sender, args) =>
            {
                if (args.NewItems != null)
                {
                    foreach (var newItem in args.NewItems)
                    {
                        picker.Items.Add((newItem ?? "").ToString());
                    }
                }
                if (args.OldItems != null)
                {
                    foreach (var oldItem in args.OldItems)
                    {
                        picker.Items.Remove((oldItem ?? "").ToString());
                    }
                }
            };
        }

        if (newValue == null)
            return;

        picker.Items.Clear();

        foreach (var item in newValue)
            picker.Items.Add((item ?? "").ToString());
    }

    /// <summary>
    /// Called when [selected item property changed].
    /// </summary>
    /// <param name="bindable">The bindable.</param>
    /// <param name="value">The value.</param>
    /// <param name="newValue">The new value.</param>
    private static void OnSelectedItemPropertyChanged(BindableObject bindable, object value, object newValue)
    {
        var picker = (BindablePicker)bindable;
        if (picker.ItemsSource != null)
            picker.SelectedIndex = picker.ItemsSource.IndexOf(picker.SelectedItem);
    }

    #endregion
}

`

Usage is pretty straight forward..:

<local:BindablePicker ItemsSource="{Binding Cats}" SelectedItem="{Binding SelectedCat}"/>

It would've been nice that the Xamarin.Forms.Picker already had this functionality, maybe we'll see it in a next update...

Any questions, comments, or contributions are welcome :)

how to handle bindable picker done click in xamarin forms for iOS ?

$
0
0

I have binding bindable picker with a viewmodel. Here I'm unable to do the alphabetical order for the items in picker and reset the bindable picker after choosing the selectedvalue item from that picker.
In xamarin forms iOS, when I choose an item from picker it will bind to the Entry control field without clicking the Done button. and if I click on that picker again it is displaying the last selected value in it.
Could you please tell me how to handle the Done click, how to reset the picker value(like just to show select one) and sorting (like alphabetical order).

Thanks in advance.

TabbedPage Icons not visible (Android)

$
0
0

Hi, I want to add Icons to my TabbedPage (see image ) but the icons don't get displayed on Android Devices:

Here's my sample code of my shared projects GetMainPage method:

`public static Page GetMainPage()
{
// First Tab
ContentPage tab1 = new ContentPage{

            Icon = "icon_home.png",
            Content = new StackLayout
            {
                Children = {
                    new Label{
                        Text = "TAB 1"
                    },
                }
            }
        };


        // Second Tab
        ContentPage tab2 = new ContentPage{

            Icon = "icon_info.png",
            Content = new StackLayout
            {
                Children = {
                    new Label{
                        Text = "TAB 2"
                    },
                }
            }
        };



        var navi = new NavigationPage(new TabbedPage
        {
            Children = { tab1, tab2,}
        }
            )
        {
            Tint = Colors.Red.ToFormsColor()
        };
        return navi;
    }`

I added the images to the "Resources.drawable" folder of my android project. Thank you in advance.

Viewing all 91519 articles
Browse latest View live