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

CarouselView 2.3.0-pre2

$
0
0

Xamarin.Forms.CarouselView

News

CarouselView is now open source:
https://github.com/xamarin/Xamarin.Forms.CarouselView

2.3.0-pre2

bugs fixed

  • 41463 - "CarouselView Crashes with "Sequence Does not Contain a Matching Element'"

  • 40513 - "Adding views to CarouselView after rendered and swiping crashes Forms"

Other fixes

Reduced assemblies referenced per platform project from three to one so
that now each platform gets its own version of Xamarin.Forms.CarouselView
into which the portable library has been merged.

For example, Android used to referenced:
  Xamarin.Forms.CarouselView
  Xamarin.Forms.CarouselView.Platform
  Xamarin.Forms.CarouselView.Android

But now only references:
  Xamarin.Forms.CarouselView (android specific)

2.3.0-pre1

Nuget package

Notes

Creating this thread to collect all CarouselView feedback until it is merged back into the Xamarin.Forms package.
James Montemagno put together a post on CarouselView here


Binding Label Text can't seem to make it work..

$
0
0

Hey all,

I have been struggling to wrap my mind around a quite simple binding. I am binding the Text property of a Label to the size of a listview itemcount.

This all works fine and the properties when debugging does contain the right values, but it does not correctly update the UI.

I have made a work around which directly sets the text with the count property. But this is not the correct way of solving this issue and does not respect the MVVM pattern. I hope you can take a look with me to maybe fix the issue.

XAML

<Label x:Name="labeltest" Text="{Binding Counter}" VerticalOptions="EndAndExpand" HorizontalOptions="CenterAndExpand" BackgroundColor="Fuchsia"></Label>

XAML.cs

 public RelationsPage(bool isRelationFlag)
        {
            InitializeComponent();
            BindingContext = new RelationsPageViewModel(this, SearchableRelationsListview,isRelationFlag, labeltest);
            _isRelationFlag = isRelationFlag;
        }

C# RelationPageViewModel

  public RelationsPageViewModel(BNPage bnpage, BNSearchableRelationsListview bnSearchableRelationsListview, bool isRelationPageFlag,Label label) {

             _bnPage = bnpage;
             _bnSearchableRelationsListview = bnSearchableRelationsListview;>             _isRelationPageFlag = isRelationPageFlag;
             _label = label;
             Counter = _relationItems.Count.ToString();



         }

        private string _testCounter;

         public string Counter
         {
             get { return $"Resultaten gevonden:{_testCounter}"; }
             set
             {
                 _testCounter = value;
                 _label.Text = Counter;
                 OnPropertyChanged("Counter");
             }
         }
         /// <summary>
         /// When the property is changed in this case "DisplayName" it will notify the UI and update this change.
        /// </summary>
         /// <param name="propertyName"></param>
        protected virtual void OnPropertyChanged(string propertyName) {
            PropertyChanged?.Invoke(this, new PropertyChangedEventArgs(propertyName));
         }

Well this is all relevant code. As you can see I directly set the label it's text in the setter, only this can't be the right way to respect MVVM

Cheers,

Luuk

Sending email from app directly

$
0
0

Hi,

is it possible to send email directly from app without opening email client? I want user to type in text and just send it to predefined email address with predefined subject.

Xamarin.Forms Global Code Styles not working.

$
0
0

I have read the doc and I can't get the global styles to work in my Xamarin.Forms 1.3.1 sample app. I can get the page based styles and built in styles work but not the global. Am I doing something wrong? Probably.

Thanks for your help in advance. Adam

using System;
using Xamarin.Forms;

namespace StyleTest
{
    public class App : Application
    {
        public App ()
        {
            Application.Current.Resources = new ResourceDictionary ();

            var labelStyle = new Style (typeof(Label)) {
                Setters = {
                    new Setter { Property = Label.TextColorProperty, Value = Color.Green }
                }
            };

            Application.Current.Resources.Add ("labelStyle", labelStyle);

            MainPage = new ContentPage {
                Content = new StackLayout {
                    VerticalOptions = LayoutOptions.Center,
                    Children = {
                        new Label {
                            StyleId = "labelStyle",
                            XAlign = TextAlignment.Center,
                            Text = "Welcome to Xamarin Forms!"
                        }
                    }
                }
            };
        }
    }
}

Why wrapper doesn't see native class when "Enable incremental builds" is enabled?

$
0
0

Hello,
I have solution that contains native library (obj c), and i use this library in my iOS project. Everything works great, but when i disable "Enable incremental builds" in iOS project properties, project compiles, but then crashes with error from native wrapper:

Wrapper type 'PlayReady.MediaRepresentationProtocol' is missing its native ObjectiveC class 'MediaRepresentationProtocol'.

My question is, how i can enable "Enable incremental building" for release purposes (i think it is impossible). Or why my project works only when this option is checked-in?

Regards.

PullToRefresh update binded stacklayout label

$
0
0

I use the nuget PullToRefresh from James Montemagno with the xaml version of code.
But i'm looking for a solution to update my label with no success.

My TestViewmodel code is :
` async Task ExecuteRefreshCommand()
{
if (IsBusy)
return;

        IsBusy = true;
        Items.Clear();

        Device.StartTimer(TimeSpan.FromSeconds(5), () =>
            {

                for (int i = 0; i < 5; i++)
                    Items.Add(DateTime.Now.AddMinutes(i).ToString("F"));

        var newpage = new BecommerceAppPage();
        newpage.getStats("stats");

                IsBusy = false;

                page.DisplayAlert("Rafraichi", "Vous avez rafraichi la page", "OK");
                return false;
            });
    }

`

The getstats function get the good datas (showed in log), but on screen there is no change. The data is not rebinded.
My xaml code :

`




                    <Label Text="VISITEURS" VerticalOptions="Center" HorizontalOptions="Start" FontSize="18" TextColor="#718894" Margin="0, 0, 0, 0" />
                    <Label x:Name="visiteurs" Text="{Binding visiteurs}" VerticalOptions="Center" HorizontalOptions="Start" FontSize="48" TextColor="White" Margin="0, 0, 0, 0" />
                </StackLayout>
            </StackLayout>
            <StackLayout VerticalOptions="FillAndExpand" HorizontalOptions="CenterAndExpand" BackgroundColor="#ffffff" Margin="0, 0, 0, 0" Padding="15, 0, 15, 0">
                <Grid VerticalOptions="CenterAndExpand" RowSpacing="15" ColumnSpacing="15">
                    <Grid.RowDefinitions>
                        <RowDefinition Height="*" />
                        <RowDefinition Height="*" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="*" />
                        <ColumnDefinition Width="*" />
                    </Grid.ColumnDefinitions>
                    <StackLayout Grid.Row="0" Grid.Column="0" BackgroundColor="#efefef" Padding="20">
                        <Label Text="COMMANDES" TextColor="#9f9f9f" HorizontalTextAlignment="Center" FontSize="10" FontAttributes="Bold" />
                        <Label x:Name="cdes" Text="{Binding Commandes}" TextColor="#d82f58" HorizontalTextAlignment="Center" FontSize="45" FontAttributes="Bold" />
                    </StackLayout>
                    <StackLayout Grid.Row="0" Grid.Column="1" BackgroundColor="#efefef" Padding="20">
                        <Label Text="SAV" TextColor="#9f9f9f" HorizontalTextAlignment="Center" FontSize="10" FontAttributes="Bold" />
                        <Label x:Name="sav" Text="{Binding Sav}" TextColor="#d82f58" HorizontalTextAlignment="Center" FontSize="45" FontAttributes="Bold" />
                    </StackLayout>
                    <StackLayout Grid.Row="1" Grid.Column="0" BackgroundColor="#efefef" Padding="20">
                        <Label Text="MISE EN PANIER" TextColor="#9f9f9f" HorizontalTextAlignment="Center" FontSize="10" FontAttributes="Bold" />
                        <Label x:Name="mep" Text="{Binding Panier}" TextColor="#d82f58" HorizontalTextAlignment="Center" FontSize="45" FontAttributes="Bold" />
                    </StackLayout>
                    <StackLayout Grid.Row="1" Grid.Column="1" BackgroundColor="#efefef" Padding="10,20,10,20" x:Name="txadiv">
                        <Label Text="TAUX D'ABANDON" TextColor="#9f9f9f" HorizontalTextAlignment="Center" FontSize="10" FontAttributes="Bold" />
                        <Label x:Name="txa" Text="{Binding txa}" TextColor="#d82f58" HorizontalTextAlignment="Center" FontSize="45" FontAttributes="Bold" />
                    </StackLayout>
                </Grid>
            </StackLayout>
        </StackLayout>
    </ScrollView>
</controls:PullToRefreshLayout>

`

Formatting Month and Date for Localization in Xamarin.Forms

$
0
0

I have the following code:

<Label Text="{Binding startTime, StringFormat='{0:MMM d, yyyy }'}" which renders June 18, 2017

I'd like to create a string that renders 18 June 2017 when the culture is not US.

Any ideas on how to do that?

Thanks.

how to change the color of Title on contentpage

$
0
0

Hi, I have a Title in a page, exactly in the ContentPage in a XAML page.

<?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="xxx.ConfigPage" Title="Config" >

I want to set the color of the Title, the Back link is blue but the title appears in Black, how can I change it ?


OAuth good practice and example

$
0
0

Hi,

I'm looking for the best way to implement OAuth (to login the user with Facebook/Twitter/Google, ...) in a Xamarin.Forms app.
The library Xamarin.Auth don't fit my needs because I need to get "token" plus "code" (not only "token").
As far as I undertand in this article: https://developers.googleblog.com/2016/08/modernizing-oauth-interactions-in-native-apps.html, it say that it's a bad practice to user Xamarin WebView to display the provider login page.
Does anybody know how to manage to use OAuth?

Thanks!

Added Context Actions to ViewCell hangs the listView

$
0
0

Hello:
I have this Cell template:

public BaseDisclosureWithActionTemplateCell() : base()
{
InitializeComponent();

        var moreAction = new MenuItem { Text = "More" };
        moreAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("{Binding ActionCommand}"));
        moreAction.Clicked += (sender, e) =>
        {
        };
        var deleteAction = new MenuItem { Text = "Delete", IsDestructive = true }; // red background
        deleteAction.SetBinding(MenuItem.CommandParameterProperty, new Binding("{Binding ActionCommand}"));
        deleteAction.Clicked += (sender, e) =>
        {
        };
        //ContextActions.Add(moreAction);
        //ContextActions.Add(deleteAction);
    }

When I add the more and DeleteAction to ContextActions, Listview never gets loaded.
The indicator spins and spins, view cells are not created apparenttly.

My ListView is defined like this:>

I can't get the cells to show up.

The baseTemplate selector is defined like this:
protected override DataTemplate OnSelectTemplate(object item, BindableObject container)
{
var b = item as BaseModel;
switch (b.ViewType)
{
case ViewType.Action:
return ActionTemplate;
case ViewType.DefaultAction:
return DefaultActionColorTemplate;
case ViewType.Disclosure:
return DisclosureTemplate;
case ViewType.DisclosureWithAction:
return DisclosureWithActionTemplate;
case ViewType.Download:
return DownloadActionTemplate;
}
return DisclosureTemplate;
}

I would love some feedback on this. This is a very strange behavior of kind I have not seen before
Anyone has any idea what is going?

A

How to hide back button in Xamarin.Forms

$
0
0

How to hide back button in Xamarin.Forms? Please help

Hint text not displaying on Android text entries

$
0
0

I'm new to xamarin, and have just created a new project. I'm wondering how I can get the floating hints/labels to appear above text fields when they are selected, as illustrated in the google material design documentation (see labels: https://material.io/guidelines/components/text-fields.html#text-fields-input)

I've created a custom renderer for my entry control, this all builds and works fine, but I'm not 100% certain of the properties of the control I need to set.

I found this article: https://blog.xamarin.com/add-beautiful-material-design-with-the-android-support-design-library/

But it seems to cover Xamarin.Android apps rather than Xamarin.Forms apps? unless I'm misunderstanding something fundamental here!

Thanks for your help!

Modal forms are empty on top of Xamarin.Forms.Maps.Map

$
0
0

I have a form that includes a Xamarin.Forms.Maps.Map control. When I push new views onto the stack with await Navigation.PushAsync(page), views that I want to be modal (using await Navigation.PushModalAsync(page)) that I push onto the stack are empty. The animation works fine, but what's animated is just empty (the background is white but with no controls or other UI elements rendered. If I remove the map control from the "root" view, the modal pages are displayed correctly. If I use .PushAsync instead of .PushModalAsync the views are displayed correctly.

I am targeting Android 6 using the Google emulators

I have no idea what's going on.

Deserialize JSON data

$
0
0

Hi,
I am getting responce in json as :

{"name":"Abhinav2","notification":[{"user1":"9123 ","user2":"123 ","createdTS":"1900-01-01T00:30:00.000Z","reviewId":null},{"user1":"9123 ","user2":"123 ","createdTS":"1900-01-01T00:30:00.000Z","reviewId":null}]}

in which name is string and notification holds an array. How to Deserialise it?

The file "obj\Debug\android\bin\packaged_resources" does not exist

$
0
0

I just installed Xamarin in Visual studio and i have installed all files from the Android SDK library as well as done any updates to visual studio.
When I create a new project and try to run it I get the error: The file "obj\Debug\android\bin\packaged_resources" does not exist. After googling people said that their may be a resource with an incorrect name but it is a new project so all files are still untouched. Ive updated all nuget packages and still get the error.

Is there anything I need to install or update that I may have missed?


Unable to Create ListView inside ListView Exception

$
0
0

System.NotSupportedException: Unable to activate instance of type Xamarin.Forms.Platform.Android.ListViewAdapter from native handle


<ListView.ItemTemplate>



<ListView.ItemTemplate>



</ListView.ItemTemplate>



</ListView.ItemTemplate>

ModernHttpClient TLS 1.2 Android API 19

$
0
0

I have to get data from a server that is using TLS 1.2. I've been able to acquire the data on iOS using ModernHttpClient

By default TLS 1.2 support is not enabled on Android devices running API 19 or older. There are ways to enable TLS 1.2 support by overriding the socket creation then passing the socket to the client. Unfortunately, I am completely at a loss on how to do that. It looks like it needs to be handled in the .Droid project itself. I suppose I'll have to handle all the HttpClient requests in the Droid project as a dependency service?

Updating the xamarin.forms to support the iOS 10 causes errors in previous versions of iOS

$
0
0

The current upgrade to iOS 10 had caused a page layout error which could be resolved by updating to the latest version of Xamarin Forms (Xamarin.Froms 2.3.3.175).
The link to the issue described is as follows:
https://forums.xamarin.com/discussion/74533/how-to-fix-page-layout-in-ios-10
However, with the fix, the updated version of the mobile app causes server connection issues in the previous version of iOS even though the app is designed to support iOS versions 7 and higher. No changes other than updating the Xamarin Forms is made to the code and the updated version of the app works perfectly on iOS 10 but its no longer functional on the previous versions of iOS (tested unsuccessfully on iOS 9.2.1).
We use the NSUrlSession to create and configure a session to interact with the server.

Any suggestions are greatly appreciated.

Achieving overlapping ListView header

$
0
0

I'm trying to achieve a look of a ListView header overlapping the top two cells in XF and haven't come up with a clean solution yet. Attached design sample below -- does anyone know how to effectively have this type of ListView layout?

System.Net.Http Could not install package 'System.Net.Http 4.3.0'. You are trying to install this pa

$
0
0

Could not install package 'System.Net.Http 4.3.0'. You are trying to install this package into a project that targets '.NETPortable,Version=v4.5,Profile=Profile259'

Last week I created an application and installed System.net.http via nuget.

This week I tried the same. I know I'm pushing my luck to expect it to work twice but I am a beginner at Xamarin.

Why does this happen?

I have circumvented the problem by installing Microsoft.Net.Http.

But the issues with Xamarin are tedious.

Viewing all 91519 articles
Browse latest View live


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