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

Xamarin Forms Carousel View in C#

$
0
0

I'm trying to create a Xamarin Forms app for iOS using a Carousel view but i'm getting no where and I can't seem to find any useful help.
I can use C# and have a fairly good knowledge of C# but I can't seem to find anything useful.
Everythig i'm seeing is using XAML code which i'm not familiar with.

If someone could provide a very simple project of a Carousel page written in C# that would be a massive help
As would anyother information on Carousel pages.


CardView layout

How to bind HTML String to WebView?

$
0
0

I've got a bindable string that's populated with HTML.

    public string Description
    {
        get { return _description; }
        set
        {
            _description = value;
            OnPropertyChanged();
        }
    }

Now I'd like that string to be bound to a webview

  <WebView Source="{Binding Description}" VerticalOptions ="FillAndExpand"/>

but this isn't working. Unfortunately the Docs for WebViewSource hasn't been entered yet.

How can I bind a string of HTML to a WebView?

How can I use binding with static property ?

$
0
0

I am using this code but its not working :

IsVisible="{x:Static local:GlobalResources.IsUserLoggedIn}"

This is the class :

public class GlobalResources { public static bool IsUserLoggedIn { get; set; } }

xamarin.forms custom url schemes?

$
0
0

Hi everyone!

I'm making an application that implements a payment gateway. When a payment is completed the payment provider returns a result url. This url can be set to be a custom url scheme such as: myapp://. For android and ios dealing with these links can be set in the androidmanifest and plist respectively.
Like so:
<activity android:icon="@drawable/Icon" android:label="RedirectActivity" android:name="walletapp.RedirectActivity"> <intent-filter> <action android:name="android.intent.action.VIEW" /> <category android:name="android.intent.category.DEFAULT" /> <category android:name="android.intent.category.BROWSABLE" /> <data android:scheme="myapp" /> <del></del></intent-filter> </activity>
After which the activity specified in the manifest(RedirectActivity) will be started when a link with the custom scheme is clicked(directed to?).

So how would I go about implementing this in a xamarin.forms application(pcl)?

Multiple projects in same solution

$
0
0

I have a feeling that there is a very simple answer to this, but after trying a few different things without success and googling around for a while I decided to ask here. The situation is that I am building 4 different apps for 4 different clients, but the code base is essentially the same - all that changes is a few settings and some assets. I am using a .NET Standard solution, and right now I have an App.Android and an App.iOS project. What I want is essentially to have a list of projects (App_A.Android, App_B.Android, App_C.Android, etc) that all reference the same shared code base. What is the best way to go about this? Any recommendations for keeping the solution easily maintainable?

Thanks in advance, hope you have a nice day

Place patterns on polyline in iOS using Xamarin.forms.maps

$
0
0

Im using Xamarin.forms.maps and successfully getting the polyline but I want to get some patterns on it as arrows and not able to achieve it.
Can anyone please help me in solving this issue and my code is as below.

    formsMap.DrawPolyLine = () =>              
    {                 
    if (nativeMaps == null)               
    {                       
    nativeMaps = Control as MKMapView;                   
    }                   
    nativeMaps.OverlayRenderer = GetOverlayRenderer;
                CLLocationCoordinate2D[] coords = new CLLocationCoordinate2D[IOSMapViewModel.DeviceTrackData.Count];
                int index = 0;
                foreach (var position in IOSMapViewModel.DeviceTrackData)
                {
                    coords[index] = new CLLocationCoordinate2D(position.Latitude, position.Longitude);
                    index++;
                }

                routeOverlay = MKGeodesicPolyline.FromCoordinates(coords);
                if (nativeMap.Overlays != null)
                    nativeMaps.RemoveOverlays(nativeMap.Overlays);
                IMKOverlay overlay = routeOverlay;

                nativeMaps.AddOverlay(routeOverlay, MKOverlayLevel.AboveLabels);
            };
            nativeMap.GetViewForAnnotation = GetViewForAnnotation;
            nativeMap.CalloutAccessoryControlTapped += OnCalloutAccessoryControlTapped;
        }
    }


    MKOverlayRenderer GetOverlayRenderer(MKMapView mapView, IMKOverlay overlayWrapper)
    {
        if (polylineRenderer == null && !Equals(overlayWrapper, null))
        {
            var overlay = Runtime.GetNSObject(overlayWrapper.Handle) as IMKOverlay;
            Foundation.NSNumber[] dashValues = { 3, 6 };
            polylineRenderer = new MKPolylineRenderer(overlay as MKGeodesicPolyline)
            {
                FillColor = UIColor.Orange,
                StrokeColor = UIColor.Orange,
                LineWidth = 3,
                Alpha = 1f,
                LineDashPattern = dashValues
            };
            //polylineRenderer.CreatePath();
        }
        return polylineRenderer;
    }

How can I get files belonging to a specific mail with OneDrive API using ADAL?

$
0
0

In the pcl project I used the Graph API to get my mails successful. I showed my mail's body in a webview, but I do not see the files sent with mail. How can I get files to be displayed in a special mail with the one drive API?


How trigger the DateSelected event of DatePicker only if the user tap on "Done" on iOS?

$
0
0

Hello,

How trigger the DateSelected event of DatePicker only if the user tap on "Done" on iOS?

Currently the event is triggered if you change the year, month or date

Best regards.

LoginPage doesn't work fine.

$
0
0

My App call the loginpage, but doesn't renderize.

    <?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="Operacional.Views.LoginPage" BackgroundColor="#072638" NavigationPage.HasNavigationBar="False">
        <ContentPage.Content>
            <StackLayout>
                <Image Source="logoestaparlogin.png" Scale="0.6"></Image>
                <Grid>
                    <Grid.RowDefinitions>
                        <RowDefinition Height="Auto" />
                        <RowDefinition Height="Auto" />
                    </Grid.RowDefinitions>
                    <Grid.ColumnDefinitions>
                        <ColumnDefinition Width="Auto"/>
                        <ColumnDefinition Width="0.8*"/>
                    </Grid.ColumnDefinitions>
                    <Entry Grid.Column="1" Grid.Row="0" IsPassword="False" x:Name="txtUsuario"  Text="27643580839" TextColor="White" />
                    <Image Grid.Column="0" Grid.Row="0" Source="personwhite.png" WidthRequest="40" HeightRequest="40" />
                    <Entry Grid.Column="1" Grid.Row="1" IsPassword="True" x:Name="txtSenha"  Text="123456" TextColor="White" />
                    <Image Grid.Column="0" Grid.Row="1" Source="lockedwhite.png" WidthRequest="40" HeightRequest="40" />
                </Grid>
                <Button Text="Entrar" x:Name="btnLogin"  BackgroundColor="#01E200" TextColor="#005400" BorderRadius="4"  Clicked="Login_Clicked" ></Button>
                <Label x:Name="lblErroLogin" TextColor="Red" ></Label>
            </StackLayout>
        </ContentPage.Content>
    </ContentPage>

but in the xaml.cs file, this page inherited ContentPage, but in my .cs file isn't good. The class name ContentPage it is not green color.

public partial class LoginPage : ContentPage ===>>> HERE ISN'T GREEN COLOR
    {
        public LoginPage ()
        {
            InitializeComponent ();
        }

        public  void Login_Clicked(object sender, EventArgs e)
        {
            LoginService svc = new LoginService();
            LoginRS res = svc.Login(txtUsuario.Text, txtSenha.Text);
            if (res != null && res.Success  )
            {
                App.LooggedUser = res;

                //MasterDetailPage fpm = new MasterDetailPage();
                //fpm.Master = new MainPage(); // You have to create a Master ContentPage()
                //fpm.Detail = new NavigationPage(new Detail()); // You have to create a Detail ContenPage()
                Application.Current.MainPage = new MainPage();

                //await Navigation.PushAsync(new MainPage());
            }
            else if(res != null && ! res.Success)
            {
                lblErroLogin.Text = res.Exception;
            }
            else
            {
                lblErroLogin.Text = "Não foi possível realizar o Login, por favor verifique sua conexão com a Internet";
            }
        }


    }

Can I see that ContextActions starts on Android in Xamarin.Forms?

$
0
0

I want to prevent other items from clicking when ContextAction starts.

So when ContextActions is displayed I want to stop clicking on the ListView after receiving the event.

open source TreeView for Xamarin.Forms - looking for contributors

$
0
0

Hey Xamarin.Forms gurus!

I needed a TreeView control for Xamarin.Forms and couldn't find one, so I did a spike and came up with a working prototype and demo app.

It its current version, data binding isn't set up, and the item template for the node header isn't separated out, but I think the demo provides a really good sense of the potential of this approach to building a TreeView as a set of nested StackLayouts (TreeNodeView inherits from StackLayout).

There's a screen image that I checked in with the source code, and I designed the layout of the demo for my 7" tablet, but it should squeeze down okay to smaller devices.

Here's the github repository:
https://github.com/danvanderboom/Xamarin-Forms-TreeView

KEY POINT: If you're familiar with best practices in building custom controls for Xamarin.Forms and you're interested in shaping the future of an open source TreeView control, let me know!

How to Redirect to a specific Page through local notification tap in xamarin forms

$
0
0

Hi, am developing a xamarin forms application. i have implemented local notifications in the app. I have used xam.plugins.notifier to display the local notifications. How to navigate to a specific page when the user taps on the local notification? How can i generate an event to navigate to a specific page? Is this possible in xamarin forms? Can someone please help me out in this?

Crash when removing the last element of an ObservableCollection

$
0
0

Hi,
After a ot of debuging, I realize that my app crash when I remove the last element of an ObservableCollection.

I saw this post from 2012 : https://social.msdn.microsoft.com/Forums/en-US/fc353ec5-8037-4d5d-8980-23b31b6f017f/ui-crashes-after-last-element-of-observable-collection-is-removed?forum=winappswithcsharp

They say that this crash is known and it'll be patch in the next version. But 4 years after, this bug is still here.
Anyone find a solution to patch this or I should just use something else like an array and don't use ObservableCollecction anymore ?

GSM Conference/Multi-party call in Xamarin.Forms

$
0
0

My aim is to make a conference/multi-party call using GSM (not VOIP/SIP/video conference, etc...) using Xamarin.Forms. I know how to make a call to a single party using the Messaging plugin. I need to know how to merge single calls into one conference call. Any help you may provide will be much appreciated.


How to perform a delay in the App constrictor?

$
0
0

Hi,

I am using OneSignal in my app and I am initializing it in the App.Xaml.cs like this:

public App()
{
    InitializeComponent();

    OneSignal.Current.StartInit("xxxxxx-xxx-xxx-xxxxx-xxxxxxxxxxx")
        .Settings(new Dictionary<string, bool>() {
        { IOSSettings.kOSSettingsKeyAutoPrompt, false } })
            .EndInit();
}

After the OneSignal.Current.StartInit I want to make a delay for few seconds and then I want to run:

OneSignal.Current.IdsAvailable((playerID, pushToken) =>
{
    id = playerID;
    App.Current.MainPage.DisplayAlert("playerId", id.ToString(), "OK");
});

because it's faking to get the IdsAvailable that quick.

How can I do that please?

Thanks,
Jassim

buttons like windows phone for(to) xamarin.forms

$
0
0

Hi all,
How can i do a layout like below screenshot? Is possible to create buttons and insert label as shown?

Anybody knows any link or tutorial?

Exception thrown when binding to text property of Lable tag inside a grid viiw

$
0
0

Am new to Xamarin development. While developing a sample app below piece of code throws an error. Any help regarding what I am doing wrong is highly appreciated .

<Label Text="{Binding FuelDetailList[0].Type, Mode=OneWay}" TextColor="#626263" FontAttributes="Bold" Grid.Row="2" Grid.Column="1" HorizontalTextAlignment="Center" VerticalTextAlignment="Center" />

Button IsEnabled Binding

$
0
0

The problem arises only on iOS platform. I have 4 buttons which should be enabled/disabled regarding to the parameter. For this to work I have a converter. When the page is first loaded I can see with debugger that the converter is used 4 timers for each button and it gives the correct boolean value. The problem is that the view is not correctly updated. If the value which defines how many buttons should be enabled is changed again then the view updates correctly. The android platform works without problem. If I change the IsEnabled to IsVisible and don't do any other changes, then the buttons are correctly visible also at the first time. What is the difference between IsEnabled and IsVisible when it comes to update the view?

Code for the Buttons and for the converter:

<Button
    Text="String1"
    IsEnabled="{Binding NumberOfStrings,
    Converter={StaticResource IntToBoolWithParameter},
    ConverterParameter=1}"
    Command="{Binding StringTapped}"
    CommandParameter="1" />

<Button
    Text="String2" 
    IsEnabled="{Binding NumberOfStrings,
    Converter={StaticResource IntToBoolWithParameter},
            ConverterParameter=2}"
    Command="{Binding StringTapped}"
    CommandParameter="2" />

<Button
    Text="String3" 
    IsEnabled="{Binding NumberOfStrings,
    Converter={StaticResource IntToBoolWithParameter},
            ConverterParameter=3}"
    Command="{Binding StringTapped}"
    CommandParameter="3" />

<Button
    Text="String4" 
    IsEnabled="{Binding NumberOfStrings,
    Converter={StaticResource IntToBoolWithParameter},
            ConverterParameter=4}"
    Command="{Binding StringTapped}"
    CommandParameter="4" />


public class IntToBoolWithParameterConverter : IValueConverter
{
    public object Convert(object value, Type targetType,
                object parameter, CultureInfo culture)
    {
        string strParam = parameter as string;
        int reference = 0;

        if (!String.IsNullOrEmpty(strParam))
        {
            Int32.TryParse(strParam, out reference);
        }

        bool answer = false;

        if (!value.Equals(null))
            answer = reference <= (int)value;

        System.Diagnostics.Debug.WriteLine(answer + " " + parameter);

        return answer;
    }

    public object ConvertBack(object value, Type targetType,
                        object parameter, CultureInfo culture)
    {
        return 0;
    }
}

Animate Listview item position change - Xamarin Forms

$
0
0
If I have a listview with items such as a leader board. What is the best way to take control of animations when positions on the leader board change?

I.e. When the item's position index changes in the listview.
Viewing all 58056 articles
Browse latest View live


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