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

Why I can't add images in "Drawable" files? Xamarin Forms - Android

$
0
0

When I try to add an image in this file, I mean.. right click on the file Drawable --> Add --> Existing item -->(Select and try to add the image ) this message appear

Message: "The system can not find the path specified"

What can I do??

I've seen so many videos where people can add images doing that without any problem, but when I try to do the same a get this message


iOS 13 broke selected row color on Listview

$
0
0

I'm in an Xamarin Forms project but after VS and XCode updates for iOS 13 my list view selected row color does not show up. Anyone else experiencing this?

An assembly with the same simple name has already been imported. Try removing one of the references

$
0
0

I need help.
So I can build and deploy my app on the android. But on iOS I get this error
"An assembly with the same simple name 'Xamarin.Forms.Platform' has already been imported. Try removing one of the references (e.g. 'C:\Microsoft\Xamarin\NuGet\xamarin.forms\4.2.0.709249\lib\Xamarin.iOS10\Xamarin.Forms.Platform.dll') or sign them to enable side-by-side. AssecoSEE.DEM.BA.SPAR.iOS C:\SPAR\DEM_BA_SPAR\AssecoSEE.DEM.BA.SPAR.iOS\CSC"

I tried removing the file mentioned, but I get another error, etc.
Could you guys help me ?

Make Page.UseSafeArea() cross-platform

$
0
0

I think that Page.UseSafeArea should be made available as a cross plattform feature in Xamarin.Forms. Since Android P, there is a way to determine the safe area. Why isn't this implemented? Is there a workarround for this?

Working with list view controls in UITest

$
0
0

Hi,

I'm trying to figure out why I cannot see all the listitems in my syncfusion listview using UITest or REPL. I can use a query such as app.Query(x=>x.All()) to see all the items on a page that doesn't have a listview, even though many of the items are scrolled way off screen. But trying this on a view that is basically just a big syncfusion listview only can see the individual listitems that are displayed or partially displayed on screen. It's almost as if All() doesn't work with listviews.

What I'm trying to do is get a count of listitems, and scroll to a specific index. But if there are many (say 20) and I can only see 5, I cannot scrolldownto the xth > 5 index item because it simply cannot be seen.

Any thoughts? Is it the control itself, a setting for the control, or typical of listview controls in general? (I'm new to Xamarin and UITests).

Thanks,

Aracknid

Custom Renderer for tabs at the bottom of the page + icon font -> Icons invisible at clicking a tab?

$
0
0

Hey there,

in my project, I am trying to display tabs at the bottom of the page, as well as on Android as on iOS.
I found out that I can achieve it by adding this line to the xaml.cs:

On().SetToolbarPlacement(ToolbarPlacement.Bottom);

In addition, I want to use icon font for the tab's icons. Therefor, I'm using the FlatTabbedRenderer from this post/example:

(For some reason, I am not able to post the link)

The first problem was, that the example renderer works with TabLayout to set the new drawable icon to it. But when I use toolbar placement at the bottom, the tab elements are not TabLayout elements any more, they are changed to BottomNavigationItemView.
So I had difficulties to address the correct view to change the icons, and I had no idea, which one is the correct Resource Id of the BottomNavigation.
I solved this by writing a workaround, which iterates through all views of the RootView and returns the one of type "BottomNavigationItemView".
Then I changed the UpdateTabbedIcons method to work with those menu items, and everything is fine....

...... until I click one of the tabs. Then, for any reason, the icons of all tabs are not visible anymore.

Has anyone an idea, why the tab's text and icon are disappearing on click?

I will try to upload a sample project that shows this behaviour.

Thanks in advance!

How to Store and View Debug Info

$
0
0

I'm developing a Xamarin Forms app in using Visual Studio along with an Android emulator. I simply want to be able to write things to a log from various pages in my app and see them output on a screen. It sounds easy, but in spite of seeing messages about Console.WriteLine, Debug.WriteLine and Log.Info/Warn/Error, and in spite of finding two log viewers in Visual Studio ("Device Log" and "Android Device Monitor"), I either get errors in the code telling me the debug commands are unknown, or else I can't find any messages in the Log/Monitor. Anybody know how to do this?

Navigating away fom modal screen causes a crash.

$
0
0

Hi all -

This is my first post as a newbie Xamarin Forms programmer.

I am trying to do the following:
1. Load a page (FooStart.xaml)
2. When I tap a button on that page, a modal window (FooModal.xaml) should load. I want this modal page to act like a pop-up menu for FooStart.
3. When I tap one of the buttons/labels in the modal window that forwards to other pages, I want the modal window to disappear and I want to be forwarded to the new page (FooEnd.xaml, for example), such that the back button on FooEnd.xaml will take me back to FooStart.xaml.

I am trying the code below, as well as various configurations, but the code that runs when the button in the modal is tapped causes the application to crash. Can anyone tell me how to accomplish this using the navigation stack? (I know there are pop-up packages out there, but this is the preferred way at this time, if it can be made to work.)

FooStart.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"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="SMS.FooStart"
             Title="FooStart">
    <ContentPage.Content>
        <StackLayout>
            <Button Text="Open FooModal" Clicked="Button_Clicked" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

FooStart.xaml.cs

using System;
using Xamarin.Forms;
using Xamarin.Forms.Xaml;

namespace SMS
{
    public partial class FooStart : ContentPage
    {
        public FooStart()
        {
            InitializeComponent();
        }
        async private void Button_Clicked(object sender, EventArgs e)
        {
            await Navigation.PushModalAsync(new FooModal());
        }
    }
}

FooModal.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"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="SMS.FooModal">
    <ContentPage.Content>
        <StackLayout>
            <Button Text="Go to FooEnd" Clicked="Button_Clicked" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

FooModal.xaml.cs

using System;
using Xamarin.Forms;

namespace SMS
{    public partial class FooModal : ContentPage
    {
        public FooModal()
        {
            InitializeComponent();
        }

        async private void Button_Clicked(object sender, EventArgs e)
        {
            Navigation.InsertPageBefore(new FooEnd(), this);
            await Navigation.PopModalAsync();
        }
    }
}

FooEnd.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"
             xmlns:d="http://xamarin.com/schemas/2014/forms/design"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             mc:Ignorable="d"
             x:Class="SMS.FooEnd"
             Title="FooEnd">
    <ContentPage.Content>
        <StackLayout>
            <Label Text="This is FooEnd" />
        </StackLayout>
    </ContentPage.Content>
</ContentPage>

FooEnd.xaml.cs

using Xamarin.Forms;

namespace SMS
{
    public partial class FooEnd : ContentPage
    {
        public FooEnd()
        {
            InitializeComponent();
        }
    }
}

Data binding of controls in .cs file

$
0
0

i have been searching for data binding but instead of being in xaml i am searching for being in .cs file, is there a manner (property) that allows me to bind the specific property to a variable?

the horizontal scroll Filter

$
0
0

how to make horizontal scrolling filtre same this example
[filter] imgur .com/BHFHgqk

how to have heart beat animation

$
0
0

Hi,

I have a like button

PostLike.ImageSource = "NotLiked.png";

which is just a white heart image and I want to change it to a red heart image when the user likes a post but I want to make a heart bean animation first so the white will scale and show little bigger red, for 2 or 3 times and then the red will be place as

PostLike.ImageSource = "Liked.png";

I tried normal ScaleTo but it is still ugly and not as pretty as this (as an example only)

https://lottiefiles.com/501-like

https://lottiefiles.com/106-save

https://lottiefiles.com/1224-like-animation

Or something like this where when the user clicks the image then it will change it immadiiatelly to Red but at the same time it will show an effect that heart is showing up with less fade until it disappers

https://lottiefiles.com/6072-hearts-animation

Kindly assist

Thanks,
Jassim

How to change the color of the status bar in Xamarin Forms

$
0
0

How to change the color of the status bar in Xamarin Forms

How to set an imagen on listview depending a value?

$
0
0
public class Person
{
    public string name                { get; set; }
    public string sex                     { get; set; }
}

I got a listview which I'm assing a List and the listview got a "image" component, I want to show one or other image in that component depending a value from the object of the list. In this case if it's a female I'm gonna show a female's picture o male in the other case. How can I do it?

--> female.png
--> male.png

Get intent data from web page OAuth2.0 redirect in a cross-platform app (iOS, Android).

$
0
0

Hi guys,

I'm trying to develop a cross-platform (Android, iOS) mobile app which uses OAuth2.0 to authorize the access to a web service. I created a Xamarin Forms app and I have a button which launches the website for OAuth2.0 authentication. I set (for Android app) an intent-filter in the Manifest file with an URI (data-scheme, data-host). I used that uri as the redirect_uri of the OAuth2.0 component so after following the authentication steps, the browser redirects to the mobile app. Can anyone suggest me an idea about how can I get the data from the intent which opens my app after it gets redirected from browser? That data contains an url which contains the authorization code which I need in my app to obtain the authorization token. I tried something with a Dependency Service, but it didn't work.

Thanks for your help!

xaml formatting


App Specific Password question

$
0
0

Lately (with the newest VS for Mac), every time I publish an app to the app store/testflight, it asks me for my Apple ID and app specific password.
Fine I log in and go generate a password.
Then i enter it and submit the app, everybody happy...
...Until next time...every single time it asks me for the same apple id and specific password.

Of course i forgot to write it down and i have to generate a new one. How can i get it to save and stop asking?? Has anybody figured it out??

Thanks!

OnNavigatedTo not called on tabbedpage child pages

$
0
0

Hi

I have a tabbed page with 2 tabs in it. I can't seem to make the on navigatedto method in the view model to get called.

After the user logs in I use the following code to navigate:

await NavigationService.NavigateAsync("/MainMasterPage/NavigationPage/PlayersHomePage");

the PlayersHomePage is a tabbedpage with 2 child pages.
the OnNavigated to is called only on the tabbed page and no on its child pages.

Is this the expected behavior?
Should I send a meesage to the other ViewModels to render their content?

Thanks

Amit

ResourceDictionary Label Text Reference

$
0
0

Hi.
I've created a DataTemplate for Listview and now I need to apply text for label, however when I give a name to a label and try to access it's text via name e.g. senderName.Text I am getting the following error
**Error CS0103 The name 'senderName' does not exist in the current context.
**
Is there any way to get the name of that label in cs file?

Thanks in advance.

Xamarin Forms WebView, can I see if the user authenticates to a site inside the webview?

$
0
0

I got an app that only contains a webview, pointing to a site with a login screen. The users of the app should be able to get notifications, but only if they are authenticated (logged in to the site in the webview). Is there any way to tell if the user of the app is authenticated to the website in the webView? Any way for the app to know if the user clicks the login button in the webview?

I know that we can override OnReceivedHttpAuthRequest in a custom renderer, but this is not triggered by the login screen of this website so it doesn't work in this case.

Any suggestions?

Can't get location

$
0
0

Hi,

I'm using Xamarin.Mobile to get the curernt location for the device. I have read the it does not work in the simulator.
Now I have testet it on a device (IOS 9.1)

But with no luck.
The GetPositionAsync never returns.

`public async Task GetCurrentLocation()
{
var locator = new Geolocator { DesiredAccuracy = 50 };
var cancelSource = new CancellationTokenSource();
var location = GeoLocation.Undefined;

        await locator.GetPositionAsync(1000, cancelSource.Token).ContinueWith(
            t => location = t.IsCompleted 
                ? new GeoLocation(t.Result.Latitude, t.Result.Longitude) 
                : GeoLocation.Undefined, 
            cancelSource.Token);

        return location;
    }`

Anyone that knows what to do?

Br Morten

Viewing all 75885 articles
Browse latest View live


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