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

ListView not binding in Prism 7

$
0
0

Below I am showing my xaml file with a ListView control and my ViewModel... I am trying to binding some items to the ListView, but nothing happens.

I am using Prism 7 as my MVVM framework.

This is my xaml with a listview:

            <ListView x:Name="lancamentos" ItemsSource="{Binding LancamentosCollection}">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ViewCell>
                            <StackLayout Orientation="Horizontal">
                                <Label Text="{Binding Descricao}" HorizontalOptions="StartAndExpand" VerticalOptions="Center"></Label>
                                <Label Text="{Binding Data}" HorizontalOptions="StartAndExpand" VerticalOptions="Center"></Label>
                                <Label Text="{Binding Valor}" HorizontalOptions="StartAndExpand" VerticalOptions="Center"></Label>
                                <Label Text="{Binding Tipo}" HorizontalOptions="StartAndExpand" VerticalOptions="Center"></Label>
                            </StackLayout>
                        </ViewCell>
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>

This is my ViewModel:

public class ClosedIncomePageViewModel : ViewModelBase
{
    private LancamentosFatura _lancamentosFatura;
    private Fatura _fatura;

//HERE IS MY COLLECTION USED AS A SOURCE IN MY LISTVIEW. IT IS PUBLIC, CAUSE IT IS AN ESSENCIAL CONFIGURATION !!!
    public ObservableCollection<Lancamento> LancamentosCollection { get; set; }

    public Fatura Fatura
    {
        get { return _fatura; }
        set { SetProperty(ref _fatura, value); }
    }

    public LancamentosFatura LancamentosFatura
    {
        get { return _lancamentosFatura; }
        set { SetProperty(ref _lancamentosFatura, value); }
    }

    public ClosedIncomePageViewModel(INavigationService navigationService)
        : base(navigationService)
    {
        LancamentosFatura = new LancamentosFatura();
    }

    public override void OnNavigatedTo(NavigationParameters parameters)
    {
        if (parameters.ContainsKey("lancamentos_fatura"))
        {
            LancamentosFatura = (LancamentosFatura)parameters["lancamentos_fatura"];

            //Atribui apenas o segundo elemento da lista de faturas (equivalente a primeira fatura fechada)
            LancamentosFatura.FaturaVisualizada = LancamentosFatura.Faturas[1];

            //Obtem os lançamentos e carrega Listview
            ObterLancamentos();
        }
    }

    private async void ObterLancamentos()
    {
        try
        {
            //Carrega o Loading...
            using (UserDialogs.Instance.Loading("Carregando..."))
            {
                await Task.Run(() => ProcessarXML());
            }

            if (LancamentosFatura.Lancamentos != null)
            {
                if (LancamentosFatura.Status.Codigo == "0")
                {

        //HERE I AM BINDING THE LIST<LANCAMENTO> TO MY LISTVIEW
        //THE LancamentosFatura.Lancamentos IS COMING WITH ITEMS, BUT THE LISTVIEW IS NOT BINDING THE ROWS
                    LancamentosCollection = new ObservableCollection<Lancamento>(LancamentosFatura.Lancamentos);

                    Toast("Lançamentos da fatura fechada recuperadas com sucesso", System.Drawing.Color.Green);
                }
                else
                {
                    Toast("Não foi possível recuperar os lançamentos da fatura fechada", System.Drawing.Color.Red);
                }
            }
            else
            {
                Toast("Não foram encontrados lançamentos para a fatura fechada", System.Drawing.Color.Orange);
            }
        }
        catch (Exception ex)
        {
            throw ex;
        }
    }

    private void ProcessarXML()
    {
    ...
    }
}

Here is my Lancamento class:

public class Lancamento : ModelBase
{
    public Lancamento(XmlElement element)
    {
        Data = GetTextValue(element, "dt_lancto");
        Descricao = GetTextValue(element, "desc_lancto");
        Valor = GetTextValue(element, "vl_lancto");
        Tipo = (GetTextValue(element, "tp_sinal") == "C" ? "Crédito" : "Débito");
    }

    public string Data { get; set; }
    public string Descricao { get; set; }
    public string Valor { get; set; }
    public string Tipo { get; set; }
}

Context is obsolete as of version 2.5

$
0
0

I updated my project to Xamarin forms 2.5. When I use Xamarin.Forms I get warning:

  Context is obsolete as of version 2.5. Please use a local context instead

How use local context instead?

Can someone please explain the anatomy of MasterDetails page?

$
0
0

I'm not sure I understand how everything works together.
To start we have a MainPage which inherits from MasterDetailsPage.
And that is the first thing that gets loaded from App.cs

But it displays what looks like a ContentPage. Is the MasterDetailsPage just the part that slides out from the side when you push the hamburger button? Or is it the entire page in the window?

Is there a link to a diagram to what each part is and how they relate? Or can someone sketch it/describe it?

Thanks

How to implement Rounded Boxview in xamarin?

Highlight listview text

$
0
0

I have a listview and search bar in my apps, I able to filterr the list based on the search bar input but I dont know how to hightlight the listview text that contain the search bar input. Can anyone help?

Breakpoints not loaded in UWP without .Net Native Toolchain enabled

$
0
0

When creating a new Net Standard Xamarin Cross-Platform App then putting a breakpoint in shared code and starting the UWP app the debugger does not break on the breakpoint and VS says the breakpoint is not loaded. If you go to [UWP app] > bin > Debug > x86 > AppX there are no pdb files, which is why I assume the breakpoints don't get loaded.

Does anyone have a solution to this? Enabling .Net Native Toolchain fixes the issue, but makes compiling much slower. An issue was posted to the VS developer community, but it doesn't seem to be getting much attention...

developercommunity.visualstudio.com/content/problem/124393/uwp-breakpoints-ignored-when-net-native-toolchain.html

Iconize plugin for Xamarin.Forms - Easily add icon fonts to your projects

Listview is not populating after navigation

$
0
0

I have listview defined in xaml as below:
<ListView x:Name="Iv" ItemSelected="Iv_ItemSelected" ItemsSource="{Binding deviceListEx}">
<ListView.ItemTemplate>
<DataTemplate>
<ViewCell>
<StackLayout>
<Label Text="{Binding .}" />
</StackLayout>
</ViewCell>
</DataTemplate>
</ListView.ItemTemplate>
</ListView>

This does work in first page load, however in ios platform when I navigate to another page then back to the listview page by clicking back button, the page is blank, means listview is not populated.
Application is in c# and working fine in android.

Have anyone faced such issue or similar issue? Do let me know how can I solve this.


New Xamarin.Forms Guide: Web Services

$
0
0

Xamarin.Forms apps can consume web services implemented using a wide variety of technologies. A new guide on consuming and authenticating access to web services using Xamarin.Forms has recently been published. The guide describes how to communicate with different web services in order to provide create, read, update, and delete (CRUD) functionality to Xamarin.Forms applications, and how to integrate authentication services into Xamarin.Forms applications in order to enable users to share a back-end while only having access to their own data. Topics covered include:

To understand the sample code provided with the guide you should be familiar with the basic principles of web services, Xamarin.Forms applications that use XAML, and asynchronous programming using Tasks. For more information see Introduction to Web Services, Getting Started with Xamarin.Forms, and Async Support Overview.

Where to start?

The suggested reading route for the guide is as follows:

image

Exploring the guide

The guide includes the following topics:

  • Understanding the Sample
    This topic provides a walkthrough of the Xamarin.Forms sample application that’s used to demonstrate how to communicate with different web services. Topics covered include the anatomy of the application, the pages, data model, and invoking web service operations.

  • Consuming an ASP.NET Web Service (ASMX)
    ASP.NET Web Services (ASMX) provide the ability to build web services that send messages over HTTP using Simple Object Access Protocol (SOAP). SOAP is a platform-independent and language-independent protocol for building and accessing web services. Consumers of an ASMX service do not need to know anything about the platform, object model, or programming language used to implement the service. They only need to understand how to send and receive SOAP messages. This topic demonstrates how to consume an ASMX web service from a Xamarin.Forms application.

  • Consuming a Windows Communication Foundation (WCF) Web Service
    WCF is Microsoft's unified framework for building service-oriented applications. It enables developers to build secure, reliable, transacted, and interoperable distributed applications. There are differences between ASP.NET Web Services (ASMX) and WCF, but it is important to understand that WCF supports the same capabilities that ASMX provides — SOAP messages over HTTP. This topic demonstrates how to consume an WCF SOAP service from a Xamarin.Forms application.

  • Consuming a RESTful Web Service
    Representational State Transfer (REST) is an architectural style for building web services. REST requests are made over HTTP using the same HTTP verbs that web browsers use to retrieve web pages and to send data to servers. This topic demonstrates how to consume a RESTful web service from a Xamarin.Forms application.

  • Consuming an Azure Mobile Service
    Azure Mobile Services is a scalable mobile application development platform that enables the functionality of mobile applications to be enhanced by using Azure. This topic, which is only applicable to Azure Mobile Services that use a JavaScript back-end, explains how to use the Xamarin component for Azure Mobile Services to query, insert, update, and delete data stored in a table in an Azure Mobile Services instance.

  • Consuming an Amazon SimpleDB Service
    Amazon SimpleDB is a web service that provides the ability to store and query data in Amazon's cloud. This topic explains how to use the AWS SDK for .NET to query, create and replace, and delete data stored in a SimpleDB service.

  • Consuming a Parse Service
    Parse provides backend solutions for mobile applications, eliminating the need for writing server code and maintaining servers. This topic demonstrates how to consume a Parse web service from a Xamarin.Forms application.

  • Authenticating a RESTful Web Service
    HTTP supports the use of several authentication mechanisms to control access to resources. Basic authentication provides access to resources to only those clients that have the correct credentials. This topic demonstrates how to use basic authentication to protect access to RESTful web service resources.

  • Authenticating Users with an Identity Provider
    Xamarin.Auth is a cross-platform SDK for authenticating users and storing their accounts. It includes OAuth authenticators that provide support for consuming identity providers such as Google, Microsoft, Facebook, and Twitter. This topic explains how to use Xamarin.Auth to manage the authentication process in a Xamarin.Forms application.

  • Authenticating Users with Azure Mobile Services
    Azure Mobile Services uses a variety of external identity providers to support authenticating and authorizing application users. Permissions can then be set on tables to restrict access to only authenticated users. This topic explains how to use Azure Mobile Services to manage the authentication process in a Xamarin.Forms application.

  • Authenticating Users with an Amazon SimpleDB Service
    Amazon SimpleDB does not offer its own resource-based permissions system. Instead, authentication against an identity provider can be used to ensure that users only have access to their own data in the SimpleDB domain. This topic explains how to restrict users' access to their own SimpleDB data.

  • Authenticating Users with a Parse Service
    The Parse .NET SDK provides classes to add user management and access control lists to an application. This topic demonstrates how to add user account functionality to a Xamarin.Forms application, and how to use access control lists to limit data access to the creating user.

Exploring the samples

Along with the guide there are also sample apps that demonstrate the concepts explained in the guide:

  • TodoASMX
    This sample demonstrates a Todo list application where the data is stored and accessed from an ASP.NET Web Service (ASMX).

  • TodoWCF
    This sample demonstrates a Todo list application where the data is stored and accessed from a Windows Communication Foundation (WCF) web service.

  • TodoREST
    This sample demonstrates a Todo list application where the data is stored and accessed from a RESTful web service.

  • TodoAzure
    This sample demonstrates a Todo list application where the data is stored and accessed from an Azure Mobile Service instance.

  • TodoAWS
    This sample demonstrates a Todo list application where the data is stored and accessed from a SimpleDB service in Amazon Web Services.

  • TodoParse
    This sample demonstrates a Todo list application where the data is stored and accessed from a Parse web service.

  • TodoAzureAuth
    This sample demonstrates a Todo list application where the data is stored, accessed, and authenticated from an Azure Mobile Service instance.

  • TodoAWSAuth
    This sample demonstrates a Todo list application where the data is stored and accessed from a SimpleDB service in Amazon Web Services, with authentication occurring with a Google login.

  • TodoParseAuth
    This sample demonstrates a Todo list application where the data is stored, accessed, and authenticated from a Parse web service.

How can I implement live filter on my custom camera renderer?

$
0
0

I'm developing custom camera app currently, and I want to implement live filter on my app. However, it's too difficult to do it.
I did following jobs: overlay transparent image(adjusting with opacity) with imageView on my textureView which renders camera preview. But in fact, this way couldn't work real filter(just adjusting opacity) and also can't save the photo. How can I do? :( Please help me

How can i change color for statusbar on ios(xamarin forms)

$
0
0

I have a dark background, so id like to change the statusbar color on ios to white. I mean only text and keep transparent...

Thanks

Application Architecture with no Database

$
0
0

Hi,
Referring to the documentation related to Application architecture of Tasky sample, I would like to know how an application architecture looks like when there is no local database.

My application's UI is built using Xamarin.Forms. I use Wikitude SDK to build and AR application. The Wikitude SDK is added as a nuget package on both iOS and Android platforms. The applications use the assets data such as images, JS files, etc.. but I have not used any database. Now, how should I draw the Architecture diagram of my application. Should I remove the Data Layer from the architecture? If so, how should I show the Asset files in each platform?

My application looks like this.

Upload byte array to server with progress percentages in Xamarin.Forms

$
0
0

I am trying to upload a byte array from Xamarin.Forms application using HttpClient. So far it's getting uploaded but I am not able to get upload progress. Is there any way to get an upload progress in percentage while file is being uploaded to server?

Here is a code snippet I am using for byte array upload.

var bytearray = videoData;
var uploadRequestBody = new ByteArrayContent(bytearray, 0, bytearray.Length);
uploadRequestBody.Headers.ContentLength = bytearray.Length;
uploadRequestBody.Headers.ContentType = new 
MediaTypeWithQualityHeaderValue("video/mp4");
HttpClient uploadRequestClient = new HttpClient();
uploadRequestClient.Timeout = TimeSpan.FromMinutes(60);
var uploadRequest = new HttpRequestMessage(HttpMethod.Put, <Some URL Endpoint>);
uploadRequest.Content = uploadRequestBody;
var uploadResponse = await uploadRequestClient.SendAsync(uploadRequest);
var uploadResponseResult = uploadResponse.Content.ReadAsStringAsync().Result;

Thanks in advance.

UWP BluetoothRfcoom DataReader "The operation identifier is not invalid”

$
0
0

I'm conneting to a device with bluetooth (UWP application) and during the connectionstate I'm available to read the data I want. However when the connection phase is complete, I'm running calls to the device every 250ms from a System.Timer from my .NET standard project.

When I do this, depening on how i create the DataWriter and DataReader (static or foreach call) I either hang forever or get:

"The operation identifier is not valid".

await dataReader.LoadAsync(Convert.ToUInt32(size));
dataReader.ReadBytes(buffer);

I have tested to run the application in a singlethreaded UWP application where it works fine. Is there any way around this? Feels like its Xamarin.

Otherwise would I need to re-write the entire functionallity for this. We are doing a cross-plattform (Xamarin) where the customer also want an UWP application to run on their Windows Tablet.

Globalization, Localization Xamarin.Forms

$
0
0

Hello World,

I'm using Visual Studio for Mac, to build iOS and Droid Applications
I'm searching an easy way to make internalisation on my Application.

First I try this way https://developer.xamarin.com/guides/xamarin-forms/application-fundamentals/localization/
But all *.Designer.cs are not auto generated.
Seems I got some problem with ResXFileCodeGenerator. ("Can only be use with .NET project" => Best Error ever in C#!)

Second I tried this way https://github.com/xleon/I18N-Portable,
but the I18n don't find my Locales folder with all en.txt *.txt
Seems I got problems with ressource files

If you got any idea why I can't make it works
Please help me

If you got any third library that can make my life easier with internationnalisation, like I18n can do when it's working.
Please tell me

Thanks by advance for your answers


how to deserialize nested json.

$
0
0

I am getting nested json in response of an API.

App is crashing while deserializing the json.

MasterDetailPage need new features (Width, Right to Left, Animations)

$
0
0

MasterDetailPage need missing features
(Width property , Right to Left direction property, animation property)

Sorry, but I have to open that has an issue since developers have to move around,
to get a nice side menu on smartphones. Don't you think?

Up the issue please ;)
github.com/xamarin/Xamarin.Forms/issues/1841

Actual Behavior
We are stuck from the left to right, with a fixed width.
But the slide gestures is awesome!

Expected Behavior
A great implementation, with some customisable properties available
_Right to left
_Width property
_Animation property (we need same animations for both device IOS, Android)

Steps to Reproduce
Implement a MasterDetailPage
Figure it out that you can't change the width of the MasterDetailPage
Realize that you can't get the MasterDetailPage from right to left
Dawn on that you never gonna get two side menu.

Xamarin forms UWP hybrid webview not calling jquery ajax.

$
0
0

I have implemented the Hybrid webview in xamarin forms. As mentioned I have included the index.html file with jquery library from web which is working in android, when I check the same in UWP it is not working, after i have copied the jquery content to local file and then success ed. When I try to implement the ajax jquery to get token. Nothing happens, how to fix and how to debug the script in html page.

How to Drag and Drop BoxView in Xamarin Forms Standard?

$
0
0

I want Drag and Drop BoxView.

so i maked pangesture and write the code

private void BoxViewPanUpdated(object sender, PanUpdatedEventArgs e) { if(e.StatusType == GestureStatus.Running) { boxview.TranslateX = e.TotalX; boxview.TranslateY = e.TotalY; } else if(e.StatusType == GestureStatus.Completed) { System.Diagnostics.Debug.WriteLine("Pan Ended"); } .... }

upper source code is example source.

Play that program, i expected to see the string "Pan Ended" when i up my finger from phone's screen,

but PanGesture's Completed or Canceld Status are not Constant.

I want move boxview to appointed position when my finger up from screen.

For example when the boxview's position is over (100,100) and my finger is not touch screen any more, the boxview's position translate to (200,200).

How can i detect screen's touch event exately?

HybridWebview Jquary ajax call

$
0
0

I'm facing the issue in jQuary.ajax (get,post) call in hybridwebview for iOS and UWP. however it is working fine in android.

Can anyone suggest me any idea how to fix.

Viewing all 77050 articles
Browse latest View live


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