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

Android application crashing on load with error [Xamarin.Forms]

$
0
0

Hi, I am creating a new Xamarin.Forms (Portable) project, when I tried to debug the application without any changes in default code, I am getting the below error.

Java.Lang.RuntimeException: Binary XML file line #1: Error inflating class Android.support.v7.widget.Toolbar

Please check the attached screenshot.

Thank You.


Xamarin.Forms 2.3.4.184-pre1

$
0
0

We've pushed Xamarin.Forms 2.3.4.184-pre1 to nuget. To install the pre-release, check the pre-release option in your nuget manager and install this version.

If you’ve got a bug to report, drop us a quick report here so we can troubleshoot in detail.

Important notes

  • Xamarin.Forms 2.3.4 depends on a Xamarin installation of Cycle 8. Users upgrading from Xamarin.Forms 2.3.3 (or earlier) will experience numerous compile errors if they attempt to build without first upgrading their Xamarin installation.

  • When upgrading Xamarin.Forms, take care not to simply "update all" as that will update the Xamarin.Android.Support packages to an incompatible version. More info here.

2.3.4.184-pre1

For all the details, please read the release post here. There is SO much goodness in this release, it's actually too long for the forum.

Html.fromHtml in Android - lists not working

$
0
0

Hi, I have done a custom control to allow html in a label, for this I'm using in Android renderer the function "Html.fromHtml" but it seems that Html.fromHtml function doesn't support lists, I mean this code

customLab.Text = @"<html><body>
  <h1>Xamarin.Forms</h1>
  <p>Welcome to Xamarin.</p>
<ul>
  <li>Coffee</li>
  <li>Tea</li>
  <li>Milk</li>
</ul>
  </body></html>";

if I render this it doesn't render the list, even if I change the custom label for a webview control it neither renders the list, any clue?

Note: it works ok in IOS renderer.

Native embedding seems to not work for me ....

$
0
0

I am trying to use the native control to get around an issue with a custom renderer I am having ...

I have a PCL project.
I am using Xamarin.Forms 2.3.3.175
I have disabled compiled XAML

I have added the reference (xmlns:ios="clr-namespace:UIKit;assembly=Xamarin.iOS;targetPlatform=iOS") like described in these blog posts:
https://blog.xamarin.com/embedding-native-controls-into-xamarin-forms/
https://blog.xamarin.com/adding-bindable-native-views-directly-to-xaml/?utm_medium=social&utm_campaign=blog&utm_source=twitter&utm_content=xaml-bindable-native-views

In my XAML I tried to add an element like so:

<ios:UISegmentedControl ></ios:UISegmentedControl>

Sadly it does no seem to know what it is...

I did verify that the UISegmentedControl is in UIKit

I need to be able to two way databind the SelectedSegment and SelectedIndex properties......

Thanks for any help with this ...

Gorilla Player - Instant XAML Preview for Xamarin.Forms :)

$
0
0

Hi everybody!

While we were working on Grial UI Kit we felt the need to improve our design cycles as much as we can.
And that was when we started looking for something that could really speed up our design iterations.

What could be better than having instant XAML preview? :)

Today we are proud to announce the pre launch of our new baby! Gorilla Player, instant XAML preview for Xamarin.Forms.
Subscribe for our beta testing program...we have limited seats ;)

Looking forward to hear your first impressions.

Best!
UXDivers team.

Is duplex WCF supported?

$
0
0

I'm trying to create a simple turn based game for iOS and Android using Xamarin.Forms. The server will be in the cloud as a WCF Services. So my first choice was a dual communication using WCF - request->response/callback (sort of event based architecture). Make a move and catch in the event response move. Anyway.. I created a PCL with targets:

.NET Framework 4.5
ASP.NET Core 1.0
Windows 8
Windows Phone Silverlight 8
Xamarin.Android
Xamarin.iOS
Xamarin.iOS (Classic)

But I can't see BasicHttpBinding.

Is dual WCF even supported? Or my PCL is configured wrong?

Thanks for help

This app is not available for your phone because it requires front facing camera

$
0
0

Hi,

We have developed an app using Xamarin Forms which targets iOS, Android and Windows Phone. We are using camera feature to take/select photos to be uploaded to the app and the feature works well on all three mentioned platforms.

We have some users facing issues on few windows devices. When a user tries to download the app from Windows App Store, they receive following error:

"This app is not available for your phone because it requires front facing camera”

I have attached screen shot showing the error for reference. The screen shot is taken from Nokia Lumia 635. Our finding that this device has only back camera, no front camera and we believe this might be the reason for above mentioned issue.

Ideally, users should not get this error as this device has back camera and they still can get the photos.

Is this a known issue in windows phone world?
Can this be fixed from code, device permissions?
Is this a device specific problem?

Any ideas?

Xamarin.Forms Feature Roadmap

$
0
0

This roadmap outlines our anticipated feature releases.

Are there things you don't see here that you feel strongly deserve a spot? Make your voice heard and open a proposal on the Xamarin.Forms Evolution forum.

Primary Focus

Quality is top of the list. This means stability and performance first and foremost. Xamarin.Forms has been swiftly adopted as a preferred tool for delivering production apps in addition to rapid prototypes. Our focus and priorities are to support the Xamarin.Forms community in those areas. In the release schedule below, we've highlighted how and where we are making those investments.

A Note About Bugs

As this thread is primarily about the feature roadmap, we anticipate the important question "what about ___ bug"?! Improving quality by addressing bugs is huge priority and ongoing focus for the team, in addition to improve our communication across the board.

Disclaimer

We cannot predict the future and how everything will shake out. Things will change. Timing may be adjusted due to priority changes, in pursuit of quality standards, or any number of other really good reasons that we will strive to proactively and openly communicate.

The Features Roadmap

Milestone Release Date
2.3.3 December 2016
2.4.0 February 2017
2.5.0 May 2017

2.3.3 - December 2016

Native View Declaration - Feature
Native view declaration allows you to add bindable iOS, Android, and Windows views directly to XAML. Rather than having to write a custom renderer, you can simply add the control directly to XAML with no additional configuration. This not only works with stock platform controls, but custom controls as well.

Platform-Specifics - Feature
Platform-specifics allow you to take advantage of native functionality that is only available on select platforms that Xamarin.Forms targets from shared code.

UWP Blur Support (3rd party nuget) - Feature
Adds the UWP blur platform-specific.

2.4.0 - February 2017

Bindable Picker - Feature
Adds data binding to the Picker control, specifically the following properties:

  • ItemSource

  • SelectedItem

https://github.com/xamarin/Xamarin.Forms/pull/515

Accessibility (A11y) Support - Feature
Proposal
Adds accessibility support to Xamarin.Forms by exposing the underlying accessibility features on iOS, Android, and Windows 10.

CarouselView v1 Stable - Feature
CarouselView was introduced at Xamarin Evolve 2016 and has been in prerelease ever since. v1 brings stability and performance improvements.

Xamarin.Forms for macOS Preview - Feature
Xamarin.Forms is coming to macOS, joining iOS, Android, Windows, and Tizen as target platforms for Xamarin.Forms.

Fast Renderers - Performance
Optimize built-in and custom view renderers to streamline view creation and improve performance.

Startup Time Improvements - Performance
Improve the startup and initialization time for Xamarin.Forms apps.

Compiled Native Views - Enhancement, Performance
Bring native view declaration to XAMLC, so users don't have to opt-out of XAMLC in PCLs where pages use native view declaration.

OnIdiom Support for Desktop (UWP) - Enhancement
Developers have lots of options when it comes to configurability based on operating system (Android, iOS, UWP, etc.), version (9, 10, etc.), and idiom (mobile or tablet). This adds Desktop as an OnIdiom for UWP developers.

https://github.com/xamarin/Xamarin.Forms/pull/420

XAMLC Enhancements - Enhancement, Performance
Approaching full support for currently supported XAML features. Compile time support for all value providers.

Deprecation of iOS 6/7

Deprecation of WP8

2.5.0 - May 2017

Xamarin.Forms Embedding - Feature
Embed Xamarin.Forms into a native Xamarin.iOS, Xamarin.Android, or Windows 10 app.

Xamarin.Forms for macOS - Feature
Xamarin.Forms is coming to macOS, joining iOS, Android, Windows, and Tizen as target platforms for Xamarin.Forms.

MenuPage - Feature
Alternative to the MasterDetail page, but rendered as a platform-specific menu that makes creating flyouts easy.

Cut down on GPU overdraw for Android - Performance
Try to avoid overdraw on Android where possible to improve performance.

Reduce native views created - Performance
Cut down on backing native views created for Xamarin.Forms, as noted by Miguel in #42948.

Layout Compression - Performance
LayoutCompression allows multiple layers of Xamarin.Forms layouts to be packed into a single native one.

Prism-Like URI Navigation Routing - Enhancement
Navigate to a page using Uri navigation, similar to what Prism does.

NavigationService.NavigateAsync("ListPage/DetailPage?id=1");

Single DLL - Enhancement
Ship Xamarin.Forms as a single DLL to improve startup performance and assist the linker.

Open Source Contributions

As noted above, the Xamarin.Forms Evolution forum is the place to start.


Add PDF attachment to e-mail message using MailKit

$
0
0

Dear all,

I find myself rather stuck on what should be a trivial issue.

I am trying to send an e-mail from my app with a PDF document as an attachment.

I am generating the PdfDocument using the API provided by Syncfusion. To send the messages, I am using MailKit. When sending a plain message everything works fine, however I cannot add an attachment to the message. I have tried various ways but I was unable to accomplish this rather simple task.

In the MailKit documentation it states nothing about adding attachments, only reading them and downloading them. This is a rather crucial function to my app.

Did any of you manage to send e-mail from your apps containing attachments?

[PRISM] Carousel Page Binding ItemsSource

$
0
0

Hello guys,

I'm trying to bind a CarouselPage.ItemsSource but i only got a result when the list is populate on the constructor.
I read this in Xamarin Documentation:
"The CarouselPage is populated with data by setting the ItemsSource property in the constructor for the code-behind file"
We can only bind itemsSource on the constructor?
I need to bind items in the OnNavigatedTo methods (PRISM MVVM) :neutral:

XAML:

<?xml version="1.0" encoding="utf-8" ?>
<CarouselPage xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
              prism:ViewModelLocator.AutowireViewModel="True"
              x:Class="APP.Views.Manager.Needs"
              ItemsSource="{Binding Pages}">

    <CarouselPage.ItemTemplate>
        <DataTemplate>
            <ContentPage BackgroundColor="Red">
                <Label Text="Hello world!"/>
            </ContentPage>
        </DataTemplate>
    </CarouselPage.ItemTemplate>

</CarouselPage>

ViewModel:

    public ObservableCollection<ContentPage> Pages { get; private set; }

    public async void OnNavigatedTo(NavigationParameters parameters)
    {
        List<ContentPage> ContentPages = new List<ContentPage>();
        ContentPages.Add(new ContentPage());
        Pages = new ObservableCollection<ContentPage>(ContentPages);
    }

Best regards

Unable to Bind Objects in ListView Xamarin Forms

$
0
0

So here is my Model class

public class User{
    public String Name;
        public String Email;
}

So here is my XAML

<?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="SampleApp.Screens.AdminApproveUsers"
             Title="Approve Users">

  <ScrollView>
    <ListView x:Name="lstUsers">
      <ListView.ItemTemplate>
        <DataTemplate>
          <ViewCell>
            <ViewCell.View>
              <StackLayout Orientation="Horizontal" VerticalOptions="Center" HorizontalOptions="Center">
                <Label Text="{Binding Name}" TextColor="Black" />
                <Label Text="{Binding Email}" TextColor="Black"  />
              </StackLayout>
            </ViewCell.View>
          </ViewCell>
        </DataTemplate>
      </ListView.ItemTemplate>
    </ListView>
  </ScrollView>
</ContentPage>

And this is how I bind it

public async void Initialize()
        {
            try
            {
                List<User> users = await ApiHandler.UserHandler.GetUsers();
                this.BindingContext = users;
                lstUsers.ItemsSource = users;

                lstUsers.ItemTapped += LstUsers_ItemTapped;
            }
            catch (Exception ex)
            {
                await DisplayAlert("Error", "Error Occurred", "OK");
            }
        }

What am I doing wrong?

How to install a test database on the Android Emulator / Visual Studio Community 2015?

$
0
0

I want to create a test database on the Android Emulator for my Xamarin Forms app.
Someone suggested an SQLite DB.
However, I can't find any information on how to install SQLite on the emulator.
(I'm a novice programmer.)
Any help much appreciated.

Thanks.

How to change the Status Bar Style ?

$
0
0

I've a Page and from that page I just jump to other page like Page 1====>Page 2
by using that code ...

            NavigationPage ppNav = new NavigationPage(new HtmlPage("PrivacyPolicy.html", Constants.PRIVACY_POLICY, true));
            ppNav.BarTextColor = Color.White;
            this.Navigation.PushModalAsync(ppNav);

Well I want a White Status Bar Icon in my app.
The problem is when I set BarTextColor to white then every thing works perfect but the Navigation Bar Title turns White and when I set BarTextColor to some other color then the status bar changes to black color .. What's the solution of this ? Also don't say to use a PushAsync...

[PRISM] Error using Master Detail Page

$
0
0

Hi guys!!!

I'm a newbie with Prism for xamarin forms.

I try create a master detail page.

When you hit the back button for android, it returns the error " Java.Lang.IllegalStateException: Activity has been destroyed "

MASTER DETAIL PAGE XAML
<?xml version="1.0" encoding="utf-8" ?>
< MasterDetailPage xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
prism:ViewModelLocator.AutowireViewModel="True"
x:Class="PrismForms.Views.RootPage" >

< / MasterDetailPage >

MASTER DETAIL PAGE CS
namespace PrismForms.Views
{
public partial class RootPage : MasterDetailPage
{
public RootPage()
{
InitializeComponent();
Master = new MainMenu();
Detail = new NavigationPage(new HomePage());
//IsPresented = false;
//masterPage.ListView.ItemSelected += OnItemSelected;
}
}
}

MAIN ACTIVITY ANDROID

namespace PrismForms.Droid
{
[Activity(Label = "PrismForms", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
{
protected override void OnCreate(Bundle bundle)
{
TabLayoutResource = Resource.Layout.tabs;
ToolbarResource = Resource.Layout.toolbar;

        base.OnCreate(bundle);

        global::Xamarin.Forms.Forms.Init(this, bundle);
        LoadApplication(new App(new AndroidInitializer()));
    }
}

public class AndroidInitializer : IPlatformInitializer
{
    public void RegisterTypes(IUnityContainer container)
    {

    }
}

}

System.Threading.Thread

$
0
0

I would like to know why in so many examples, where we want to set current culture, Xamarin uses System.Threading.Thread. This cannot be obtained. Not in PCL and not in WindowsPhone. Why are these examples up on their pages. They are missleading.

Can anyone shed some light on this matter?


StackLayout.Children.Add couses error Java.Lang.NullPointerException:

$
0
0

I'm trying to show a list of files with two or more columns.
The way i found it was to create a stack vertically with another stack horizontally.
But when i try to refresh it, in the "OnAppearing" event, this error is displayed:

Java.Lang.NullPointerException:

code:

` public void AdjustGrid()
{
int collumnIndex = 0;

        int rowIndex = 0;

        if (this.Width > 100)
        {
            numCollumns = Convert.ToInt32((int)Math.Ceiling(this.Width / this.imageSize));
        }

        {
            if (this.dao.List.Count > 1)
            {
                numRows = Convert.ToInt32((int)Math.Floor((double)this.dao.List.Count / (double)numCollumns));
            }
            else
            {
                numRows = 1;
            }
        }


        if (numCollumns > 0 && numRows > 0)
        {


            if (this.fileStackExplorer != null)
            {
                if (this.fileStackExplorer.Children != null)
                {
                    this.fileStackExplorer.Children.Clear();
                }

                StackLayout Stack = new StackLayout();


                foreach (var file in dao.List)
                {

                    Image slide = new Image
                    {
                        Source = ImageSource.FromResource("Promob_Draw.Identity.nautilus.png"),
                        Aspect = Aspect.AspectFill
                    };



                    Frame backSlide = new Frame
                    {
                        HasShadow = true,
                        OutlineColor = Color.Black
                    };

                    var Subgrid = new Grid
                    {
                        VerticalOptions = LayoutOptions.FillAndExpand,



                        RowDefinitions =
              {
                    new RowDefinition{ Height = new GridLength(15, GridUnitType.Absolute)},

                    new RowDefinition{ Height = new GridLength(imageSize-30, GridUnitType.Absolute)},

            },




                        ColumnDefinitions =
            {
                        new ColumnDefinition { Width = new GridLength(15, GridUnitType.Absolute) },

                        new ColumnDefinition { Width = new GridLength(imageSize-30, GridUnitType.Absolute) },


            }
                        #endregion
                    };

                    Subgrid.RowSpacing = 0;

                    Subgrid.ColumnSpacing = 0;

                    Subgrid.BackgroundColor = Color.Transparent;


                    Label item_atual = new Label
                    {
                        Text = file.DraftName,
                        VerticalTextAlignment = TextAlignment.End,
                        HorizontalTextAlignment = TextAlignment.Center,
                        TextColor = Color.Black,
                        BackgroundColor = Color.Transparent,
                        FontAttributes = FontAttributes.Bold
                    };


                    backSlide.Content = slide;

                    Subgrid.Children.Add(backSlide, 1, 1);


                    if (collumnIndex == 0)
                    {
                        Stack = new StackLayout
                        {
                            VerticalOptions = LayoutOptions.FillAndExpand,
                            HorizontalOptions = LayoutOptions.CenterAndExpand,
                            Orientation = StackOrientation.Horizontal
                        };
                        this.fileStackExplorer.Children.Add(Stack);

                    }

                    Grid Grid = new Grid
                    {
                        VerticalOptions = LayoutOptions.FillAndExpand,

                        RowDefinitions =
                        {
                            new RowDefinition{ Height = new GridLength(imageSize, GridUnitType.Absolute)},
                        },

                        ColumnDefinitions =
                        {
                            new ColumnDefinition { Width = new GridLength(imageSize, GridUnitType.Absolute) },
                        }

                    };

                    Grid.Children.Add(Subgrid, 0, 0);

                    Grid.Children.Add(item_atual, 0, 0);

                    Stack.Children.Add(Grid);

                    if (collumnIndex < (numCollumns - 1))
                    {
                        collumnIndex++;
                    }
                    else
                    {
                        collumnIndex = 0;
                        rowIndex++;
                    }
                }
            }
        }
    }

    protected override void OnAppearing()
    {
        this.FadeTo(1);

        this.AdjustGrid();

        base.OnAppearing();

    }`

any idea?

Assembly for xmlns:locate not found (Forms-Project with XAML)

$
0
0

Hi,

in my Shared-Forms-Project "BorrowedBooks" this "MainPage" made in XAML should dislpay a list of books. The list is a static member in App.cs

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                        xmlns:local="clr-namespace:BorrowedBooks;assembly=BorrowedBooks"
                       x:Class="BorrowedBooks.Views.MainPage"
                       Title="Borrowed Books">
    <ListView x:Name="listView" IsVisible="true" ItemsSource="{x:Static local:App.BorrowedBooks}">
        <ListView.ItemTemplate>
            <DataTemplate>
                <ViewCell>
                    <ViewCell.View>
                        <StackLayout Orientation="Vertical" HorizontalOptions="CenterAndExpand">
                            <Label Text="{Binding Name}" HorizontalOptions="Center" />
                            <Label Text="{Binding Author}" Font="10" HorizontalOptions="Center"/>
                        </StackLayout>
                    </ViewCell.View>
                </ViewCell>
            </DataTemplate>
        </ListView.ItemTemplate>
    </ListView>
</ContentPage>

The problematic point is following line:

xmlns:local="clr-namespace:BorrowedBooks;assembly=BorrowedBooks"

If I debug the App on any platform (WinPhone, Android), an IOExpection occurs and tells me that the assembly "BorrowedBooks" was not found.

If I run it on Anroid and change the code like this, then it works perfetly:

xmlns:local="clr-namespace:BorrowedBooks;assembly=BorrowedBooks.Android"

The same works analog with "WinPhone", but I think this should work without the platform specific name?

I'm using Visual Studio 2013 Update 3 and the current Xamarin version.

Tabbed Chlid Page OnApearing Invoking Twice

$
0
0

Hey Guys

I'm using TabbedPage having two child inside e.g. A and B (XAML)

Now when I'm navigating to TabbedPage so, A page OnAppearing invoking two time which my default page in tab. is this the default behavior in tab or I'm doing something wrong ?

Thanks

How to make master detail page below the toolbar

$
0
0

Hi guys,

I want to make my master detail page appears below the toolbar.
Exactly like this

Instead this

Google Auth Error:disallowed_useragent

$
0
0

I am getting Google Auth Error:disallowed_useragent in iOS when I try to authenticate google login using xamarin.auth.Google Document says Google has changed its Oauth policies, with this it is intended that no native web views initiate Oauth flows.So now, how to authenticate google login using xamarin.auth ?

Viewing all 91519 articles
Browse latest View live


<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>