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

Problema em somar valores de um Listview Xamarin

$
0
0

Olá pessoal,
estou com uma dificuldade em somar os valores exibido dentro de um ListView e exibir em uma Label;

A Idea é bem simples, (exemplo) eu carrego 5 linhas do ListView com valores distintos (1 ,2, 3, 4, 5) e preciso obter a soma destes valores ( total 15 ) para informar numa Label, já utilizei um FOR mas o ListView não aceita listView.Items[i]; exatamente o ".Items".

Alguém pode ajudar em obter essa soma?

Obrigado!!


listview is not scrolling when the keyboard is raised in android.

$
0
0

hi guys,
i am having 2 issues

1)am trying to scroll the listview automatically in 2 scenario's.
a.when the page is loaded the listview will be scrolled automatically-it's working.
b.when the bottom editor is focused then also the listview must be scrolled to the last item when the keyboard is raised.

i have written the same code when the page is loaded but it's not working.

in the ios its working fine but in android its not working.

2)In IOS ,When the editor is focused the keyboard is getting overlayed on the editor and the editor is not visible how to push that editor to the top of the keyboard.

describing these problems here am attaching the sample project link:

https://www.dropbox.com/s/5bdlwxevbhvi76l/ListviewExperiments.zip?dl=0

gps tracker in real time like uber or cabify

$
0
0

Hello guys,
I want to made an application that you can tracking people in real time like UBER or Cabify, I don't know how can I do this, my Idea is the follow

this is my idea but I dont know if this is the correct form, please can you please help me with this? anyon

Live/Hot reloading at runtime that WORKS!

Where are the XAML designer tools?

$
0
0
Years have past ;-) not really but I think this question has been asked many Times' before.

The forms previewer crash all the time. It could be seen more of a compile:designer that breaks as soon as you start adding codebehind stuff.

We need a designer for Xaml not css? I think the web guys gonna stick to other tools anyways
The live previewer very nice idea, same thing doesn't work yet.

I just need BLEND with a Visual state manager. where is the backning from the Microsoft team that dream up stuff like the Blend tools :-)

i am using WKWebView for ios in xamarin forms to display pdf but it is not working in real device

$
0
0

Control.LoadRequest(new NSUrlRequest(new NSUrl(Path,false)));
Control.Reload();

i am using this code it is working fine in simulator but not in real device help!

Open tab from other page

$
0
0

Hi all,
I created a ContentPage with 4 buttons, and a TabbedPage with 4 tabs.

Now I can open the TabbedPage, but always shows the first tab and I'm trying to open the tab that is selected on the button, first button opens TabbedPage on the first tab, the second button I want to open the TabbedPage on the second tab...

But I don't know how to do it, help will be appreciated.

StackLayout : bug with horizontal orientation and long text in entry

$
0
0

Hi,

I want to use a layout similar to the one presented in the last example of this page : https://developer.xamarin.com/guides/xamarin-forms/user-interface/layouts/stack-layout/

My goal is to align in Android a label and an entry in a horizontal StackLayout like this :

`<StackLayout Orientation="Horizontal">
        <Label FontSize="14" Text="Ask me about:" TextColor="White"
        HorizontalOptions="Start" VerticalOptions="Center" WidthRequest="100"/>
        <Entry HorizontalOptions="FillAndExpand" Text="Xamarin, C#, .NET, Mono... " TextColor="White" BackgroundColor="Maroon" />
      </StackLayout>`

This example renders OK. However if I use a longer text, the entry will expand towards the label and make it shrink :
image

I can try to fix that by setting the MinimumWidthRequest on the label, but then I got another problem :
It seems the entry sets its minimum width to the length of its text. When the text is too long, you can see that the entry overlaps on the right side of the screen. The problem here is that when the entry overlaps, I cannot scroll the text horizontally (like in a 'normal' entry), making it really difficult to view and edit.
image

Is there a way to make the entry sets its width correctly, regardless of the length of the initial text ?

Thanks !


how can stretch background content image?

$
0
0

How can i set the background no-repeat but stretch dinamically to all page?

Show two pages side by side or as seperate pages

$
0
0

Hello,

I have two pages (a master and a detail page) that I want to show in my Xamarin.Forms app. The layout can be compared the UWP Mail app: The master page contains the list of all messages and the detail page shows one e-mail message. When the width of the app is small (e.g. phone), only one page is shown at a given time. When the users wants to read the email message (= visit the details page), the list of messages disappears and only the email message is shown (= navigates from master page to detail page). When the width of the app is sufficiently large (e.g. tablet in landscape mode), the list of email messages is shown on the left and the selected message is displayed on the right (= master and detail page are shown side by side).

How can I recreate such a behavior for my app? My master page is a list view from which I can navigate to the detail page, but I also want to show these two pages side by side when the app is wide enough.

My details "page" does not have to be a XAML page, I could also use e.g. ContentView if this is easier. However, thus far I was unable to create the layout I described.

Regards,
Philipp

Xamarin Forms ADMob (Firebase.ADS) Not Show

$
0
0

Hello, I have a problem.
I am using the Firebase.ADS plugin to add ads to my application however I am getting this error message and the advertisement is not displayed!
I'm in a .netstandard2.0 project

12-29 22:05:30.118 I/Ads (24010): Ad failed to load : 3

I need Help Please!

iOS Native Linking Error

$
0
0

When I attempt to run my xamarin forms app using the iOS simulator I'm getting the following errors around linking. I'm using a new dll that I created. The simulator is paired with a mac mini that is running macOS High Sierra Version 10.13.3, Xcode 9.1, and Visual Studio for Mac Enterprise 7.4. I was curious if anybody had any ideas about what was causing these errors?

Severity Code Description Project File Line Suppression State
Error Native linking error: framework not found /Users/dwighthyde/Library/Caches/Xamarin/mtbs/builds/UCH.MHC.Mobile.iOS/febaa3b698a046262026a17f2d96a20b/obj/iPhoneSimulator/Debug/mtouch-cache/x86_64/registrar.o UCH.MHC.Mobile.iOS

Severity Code Description Project File Line Suppression State
Error Native linking failed. Please review the build log. UCH.MHC.Mobile.iOS

Severity Code Description Project File Line Suppression State
Error Native linking failed. Please review the build log and the user flags provided to gcc: -Xlinker -sectcreate -Xlinker __TEXT -Xlinker __entitlements -Xlinker /Users/dwighthyde/Library/Caches/Xamarin/mtbs/builds/UCH.MHC.Mobile.iOS/febaa3b698a046262026a17f2d96a20b/obj/iPhoneSimulator/Debug/Entitlements.xcent UCH.MHC.Mobile.iOS

Deploying HttpClient - NameResolutionFailure - only on iOS device

$
0
0

Hi All,

I'm having an issue with httpClient, but only on my iOS device (I've not checked Android but I'm not targeting it), it works well in the emulator.

When my app loads the ViewModels do a API call to try and get data from my server and I almost immediately get a System.Net.WebException: Error: NameResolutionFailure crash. I don't get this in the iOS emulator for the same API call.

I tried calling https://jsonplaceholder.typicode.com/posts which I know works and rules out anything idiosyncratic bugs in my code but it still fails.

Is there anything special I need to do enable internet access on an iOS device? Could I have set up something wrong in my provisioning profile in the Apple Account?

Thanks in advance

Complie Error

$
0
0

Any one help, when tried to compile system throw below error. three times uninstall VS and Xamarin. but no use.

packaging of 'C:\Users\XXXXXXX\AppData\Local\Temp\nykza20f.fpe\resources.apk.bk' failed App1.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1703
ERROR: unable to open 'obj\Debug\81\lp\5\jl\bin\classes.jar' as a zip file: -40 "classes.jar' as a zip file: -40". App1.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1703
unable to process jar files while packaging 'C:\Users\XXXXXXX\AppData\Local\Temp\nykza20f.fpe\resources.apk.bk' App1.Android C:\Program Files (x86)\Microsoft Visual Studio\2017\Professional\MSBuild\Xamarin\Android\Xamarin.Android.Common.targets 1703

Hover Effect is not working properly on button in Xamarin UWP

$
0
0

I tried to add a hover effect for a button.
Following code shows a custom class created in UWP

[assembly: ResolutionGroupName("MyCompany")]
[assembly: ExportEffect(typeof(FocusEffect), "FocusEffect")]
namespace EffectsSample.UWP
{
    class FocusEffect : PlatformEffect
    {
        protected override void OnAttached()
        {
            try
            {
                (Control as Windows.UI.Xaml.Controls.Control).PointerEntered += pointer_Entered;    
            }
            catch (Exception ex)
            {
                Debug.WriteLine("Cannot set property on attached control. Error: ", ex.Message);
            }
        }
        private void pointer_Entered(object sender, RoutedEventArgs e)
        {           
            (this.Control as Windows.UI.Xaml.Controls.Control).Background = new SolidColorBrush(Colors.Red);   
        }         
        protected override void OnDetached()
        {
        }
       }
    }

Effect is added to button in xaml like below:

   <Button Text="Button">
        <Button.Effects>
            <local:FocusEffect />
        </Button.Effects>
    </Button>

The issue is that background is not changing on Pointer Enter Event. Instead it changes on Pointer Exit.
Any help will be appreciated!


SVG image is not displaying in android in xamarin.forms

$
0
0

I am trying ti display the SVG image in my xamarin.form application, there are no issues to display the SVG image in iOS but not able to display the same image in the android application.

here is my code to display the svg image
<ContentView.Resources> <ResourceDictionary> <ffimageloadingsvg:SvgImageSourceConverter x:Key="SvgImageSourceConverter"></ffimageloadingsvg:SvgImageSourceConverter> </ResourceDictionary> </ContentView.Resources> <ContentView.Content> <ffimageloadingsvg:SvgCachedImage Source="{Binding SvgFileName, Converter={StaticResource SvgImageSourceConverter}}" Grid.Column="0" WidthRequest="200" HeightRequest="600" ReplaceStringMap="{Binding BodyMapreplceStrings}" /> </ContentView.Content>

And from View Model I am binding the image as following

 public string SvgFileName
        {
            get { return _svgFileName; }
            set
            {
                _svgFileName = value;
                OnPropertyChanged();
            }
        }

and

SvgFileName="Flower.svg";

and given svg image in Resources for iOS and in Resources ->drawable

in MainActivity added following lines
CachedImageRenderer.Init(true);
var ignore = typeof(SvgCachedImage);

Is there anything I am missing?

How to detect text and search a location over mapview?

$
0
0

I added mapview using xamarin.forms.maps package. I wanted to add a searchbar field to search address and drop pin using search box.

How to add a SearchBar programmatically a search a location?

I tried the following:

var searchField = new SearchBar
{
Placeholder = "Enter search term"
};
searchField.SearchCommand = new Command(() => { if (searchField != null) { string.Format("Result: {0} is what you asked for.", searchField.Text); }
** // I don't get the text here**

Content = new StackLayout
{
Spacing = 0,
Children = {
searchField,
map,
buttons
}
};

Xamarin form : Unable to recieve IOS firebase token

$
0
0

i have developed a project for android and ios. FCM notificaiton works fine for android i can get token as well, but i am not able to get ios token from fcm and getting these errors

2018-12-29 16:12:31.298436+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID009001] Error removing keypair status: -34018
2018-12-29 16:12:31.299426+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010007] Unable to remove RSA keypair
2018-12-29 16:12:32.865414+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID010003] Unable to generate keypair.
2018-12-29 16:12:32.865788+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID010009] Keypair could not be loaded from Keychain. Error: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:32.866843+0500 Consultant.iOS[26902:871853] [Firebase/Analytics][I-ACS020001] Failed to get InstanceID: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:32.887691+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID009001] Error removing keypair status: -34018
2018-12-29 16:12:32.887954+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010007] Unable to remove RSA keypair
2018-12-29 16:12:33.061443+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010003] Unable to generate keypair.
2018-12-29 16:12:33.062002+0500 Consultant.iOS[26902:871906] [Firebase/InstanceID][I-IID010009] Keypair could not be loaded from Keychain. Error: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:33.062421+0500 Consultant.iOS[26902:871906] [Firebase/Analytics][I-ACS020001] Failed to get InstanceID: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:33.078473+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID009001] Error removing keypair status: -34018
2018-12-29 16:12:33.078835+0500 Consultant.iOS[26902:871853] [Firebase/InstanceID][I-IID010007] Unable to remove RSA keypair
2018-12-29 16:12:33.600527+0500 Consultant.iOS[26902:871850] [Firebase/InstanceID][I-IID010003] Unable to generate keypair.
2018-12-29 16:12:33.600801+0500 Consultant.iOS[26902:871850] [Firebase/InstanceID][I-IID010009] Keypair could not be loaded from Keychain. Error: Error Domain=com.firebase.iid Code=-34018 "(null)"
2018-12-29 16:12:33.601524+0500 Consultant.iOS[26902:871850] [Firebase/Analytics][I-ACS020001] Failed to get InstanceID: Error Domain=com.firebase.iid Code=-34018 "(null)"
Thread finished: <Thread Pool> #78

How to export/save the keystore files from MAC

$
0
0

I am using MAC visual studio for xamarin forms app development. I am trying to take a back up for my android keystore files.

I found the keystore files at /Users/[username]/Library/Developer/Xamarin/Keystore/ in my MAC using keystore explorer. How can I export or save the keystore files from here? Copy/paste, drag and drop and export options are not working.

Anyone, please tell me a way to export the keystore files from MAC?

Showing white blank page before navigating from Login page to MasterDetailpage in Xamarin Form

$
0
0

Hi, I'm working on app in Xamarin form where I need to login first in login page , then if succeed will it navigate to master detail page. I able to achieved it but when navigating from Login page to masterdetail page, it show <1second white blank page in between the navigation. Is that any way to make it navigate more faster without showing the white page? I'm using the masterdetail (https://docs.microsoft.com/en-us/xamarin/xamarin-forms/app-fundamentals/navigation/master-detail-page) page template provide by the Xamarin form.
Below show how I navigate between the pages.

      MainPage = new LoginPage();
      Application.Current.MainPage = new MasterDetailPage();
Viewing all 91519 articles
Browse latest View live


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