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

ListView detect itemsource changes

$
0
0

I've setup everything correctly using MVVM.
My ListView gets updated correctly when new Items are added to the List because my ViewModel implements INotifyPropertyChanged
Now I'd like to scroll to that item, which is the last in list when it is added.

I've thought about the propertychanged callback on the listview, but it is not called.
Is there a method to get a collectionchanged like behaviour?


How to go to SPECIFIC PAGE when user clicks on Push Notification

$
0
0

I have a Xamarin.Forms app (XF 1.3.4) that uses Azure Messaging to connect with GCM and APNS. The app works great - the app registers for push notifications, and push notifications are received successfully from Azure Notification Hubs on iOS and Android.

My question - how do I get my app to launch into or display a specific page when the user taps on a push notification, (1) when the app isn't running, AND (2) when the app is already running???

I've seen this question asked a few times in the forums, but I haven't seen a cohesive/detailed response yet.

Can someone please provide an answer with source code, or point me to a solution online that explicitly shows how to pass data from a push notification, through the platform-specific code, to the PCL code? ALSO, I don't want or need to integrate with another plugin (Push Notifications Plugin or otherwise) - I have push notifications working, I just need to make them content-aware.

Thanks!

Standard set of Assets/Resources for getting started

$
0
0

Does anyone know of a standard set of Assets / Resources that can be used while learning / prototyping with Xamarin?

Android resources, NullReferenceException thrown at launch

$
0
0

I'm trying to add a sound file to my Xamarin.Forms app. Following https://developer.xamarin.com/recipes/android/media/audio/play_audio/ I created the "raw" directory, placed my file in, and changed the Build Action to AndroidResource. Built the app--which was fine--then ran it. At launch, received a NullReferenceException in MainActivity.OnCreate, in the line "Load Application(new App());"

Removing the resource allows it to run again.

VS 2017 15.5.4
Xamarin 4.8.0.757
Xamarin.Android SDK - 8.1.3.0

What's the problem?

Picker on SelectedItem / SelectedIndex not changing picker text

$
0
0

I'm trying to change a value of a Picker with the SelectedIndexChanged from another Picker ...

serverPicker.SelectedIndexChanged += (sender, e) => {
    int index = getIndex(serverPicker.SelectedIndex);
    mobilePrefixPicker.SelectedIndex = index;
};

mobilePrefixPicker's SelectedIndex and SelectedItem does change however it isn't reflected on the GUI.

For Android it didn't look like the value have changed however selecting mobilePrefixPicker you can see that the value selected has actually been changed.
For iOS it didn't look like the value have changed and clicking into it it also looks like the selected value haven't been changed.

In both cases while debugging the values of SelectedIndex and SelectedItem have actually changed.

Is this issue a bug? If so is there a workaround?

Xamarin.Forms binding with indexers crashes application

$
0
0

When using an object with two indexers, the binding can't resolve it and the application crashes.

For instance, if the following binding is set

<Label Text="{Binding [asdf]}" />

And the BindingContext is an instance of the following class

public class MyClass
{
    public string this[int index]
    {
        get
        {
            return "Accessing through integer indexer";
        }
    }

    public string this[string index]
    {
        get
        {
            return "Accessing through string indexer";
        }
    }
}

an unhandled exception is thrown.

if the integer indexer is commented the binding works fine.

Regards,
Alvaro.

Blurred text on Xamarin.Label inside a ViewCell on iPad

$
0
0

Hi,

I've implemented a custom cell class that extends ViewCell, it contains two Labels nested inside a StackLayout. On Android it looks fine but on iOS the text is noticeably blurred compared to a standard TextCell.

The code from my object's constructor is below and screenshot from an iPad attached, the rows that have email icons on them are the custom ViewCell (Lead Partner Email etc).

// construct labels for label and value text, platform specific colours and sizes to match other Xamarin Cell objects
var textLabel = new Label
{
    Text = this.Text, 
    TextColor = Device.OnPlatform(Color.Default, Color.Accent, Color.Default)
};
var detailLabel = new Label
{
    Text = this.Detail,
    TextColor = Device.OnPlatform(Color.Accent, Color.Default, Color.Default),
    Font = Device.OnPlatform(Font.SystemFontOfSize(NamedSize.Micro), Font.Default, Font.Default)
};

// create a layout for this cell
var layout = new StackLayout
{
    Padding = new Thickness(16, 3),
    Orientation = StackOrientation.Horizontal,
    Children =
    {
        new StackLayout
        {
            HorizontalOptions = LayoutOptions.StartAndExpand,
            Spacing = 0,
            Children =
            {
                textLabel,
                detailLabel
            }
        },
        new Image
        {
            Source = ImageSource.FromFile(imageFilename),
            Aspect = Aspect.AspectFit
        }
    }
};

this.View = layout;

Any help would be appreciated!

Xamarin.Forms + offline map navigation

$
0
0

Hi all!

My current project requires map navigation while the device is disconnected from the internet. The route which will be followed is known, so after login the route with the map has to be downloaded and after that used in places with limited connection. The user will also be able to place markers (pins) on the map. I'm currently trying to implement Open Street Maps using Mapsui and renderers for iOS and Android, but I'm not sure yet if it is the way to go.

Is there any ready solution for this?


Drop Down List using Xamarin Forms

$
0
0

I want to create a Drop down list using Xamarin forms. Should allow single selection form a list of values. Could someone please give me references of how to achieve this.

Xamarin Forms w/ .NET 2.0 Standard - Play Background Audio?

$
0
0

Is there a way to play Audio (and background playing) Files in Xamarin Forms with code in the .NET 2.0 standard project? Without coding each iOS or Android platform specific?

Thank you.

How can I change the hamburger icon for another one in Xamarin.Forms for Android?

$
0
0

How can I change the hamburger icon for another one in Xamarin.Forms for Android?

I tried a lot of methods to change the three bars (hamburger icon) for another icon with Xamarin.Forms, but it seems to always use the burger.

For iOS I already checked, and it works really great, but for some reason I can't show the same picture in Android.

For Android I'm using a default project created with the latest Xamarin Studio 6. It generates a MainActivity of type FormsAppCompatActivity.

Is there any way to change the picture consistently?

RelativeLayout in XAML - RelativeToView (parent,sibling) => sibling.Bounds.Bottom in Xaml?

$
0
0

Hi guys,

Im trying to set a Constraint in XAML to bottom of another view, in XAML. Normally in C# I would write:
RelativeLayout in XAML - RelativeToView (parent,sibling) => sibling.Bounds.Bottom

How to do it in XAML?
RelativeLayout.YConstraint="{ConstraintExpression Type=RelativeToView,Property=Height, ElementName=logo,Constant=0}"

I tried to set the Property=Height to Property=Bounds.Bottom and Property=Bottom non of them available.

Any suggestions?

Thanks in advance

How to use Natvie sdk in xamarin.forms?

$
0
0

I'm developing mobile application using Xamarin.Forms for android and iOS. I have payment gateway(Braintree) SDK in native android(Java) and iOS(Objective c / Swift).
For android, I have tried creating binding library using *.Jar file, however not able to converted that Jar to dll. Facing errors like " does not implement interface member " even after creating the partial class also not working.
For iOS, I'm not able to find proper header file to convert.

Sockets not sending data on UWP on last Xamarin with .NET Standard 2.0

$
0
0

I am teaching Xamarin from several years ago, and I do a sample application that sends and receive data using sockets to a custom server. Until now, my code always has worked correctly under all platforms. But, I has tested today with last Xamarin Forms with .NET Standard 2.0 project. I have realized that it works correctly under Android as always, but refuses to send (and receive) data under UWP. It seems to connect correctly to socket server endpoint, but when I try to send data, it never send it and receive a Timeout. A standalone UWP application using same communications code, works also correctly. So I asume that is some issue due the new .NET Standard 2.0, because old apps that works, use older .NET Standard versions.

Any information or help to solve this issue? (I have tried to downgrade the shared .NET Standard code to 1.X, but then I have some other errors and can't compile).

Thanks in advance.
Ruben

Xamarin forms Navigation page

$
0
0

Hi,

is there a way to make navigation page title to the center of the page.

sismail


Create a menu with sub menus in one option using MasterDetailPage

$
0
0

Hello,

I'm doing a menu using master detail page. And I need to add submenus only in one of the options.
I have looked at grouping in listviews, but that would work if every option have sub menus.

What would be the best way to do this?

Thanks

How to configure SSL/TLS with a self signed certificate for iOS project.

$
0
0

Hi all,
I've this problem: I am developing a PCL app and I need to call Api hosted in my working company's server. This endpoint have a self signed certificate encrypted and authenticated using TLS 1.2 ECDHE_RSA with X25519 , and AES_256_GCM.

In OnCreate(Droid) and in FinishedLaunching(iOS) methods I have added this code (suggested by tons of similar post):
ServicePointManager.ServerCertificateValidationCallback += (sender, certificate, chain, sslPolicyErrors) => true; to resolve the problem of the untrusted certificate.
In Android works well but in iOS my request incurs in timeout response.

One solution is send the certificate to all devices in test environment and install it on device, but I am not able to send the certificate.
Then, how can i resolve this?

Thank you in advance for anyone who wants to answer.

Error occurred trying to install required android component

$
0
0

I have a new Windows 10 machine. I have pulled my source code that is working great on my old Windows machine but continually get the above error on the new machine I have reinstalled Visual Studio, I have repaired Visual Studio, I have downloaded and pointed to the NDK, I have downloaded and installed the JDK (first 9.0 and then 8.0) I have removed and restored NuGet packages and I have prayed to the gods of programming.

Any suggestions?

Thanks

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.

iPhone X and safe margins with Xamarin Forms

$
0
0

Hi!

I have finished my app, but I have tested it with the iPhone X simulator and I'm totally out of the safe margins.

I'm searching for info everywhere, but I can't find anything specific to that.

I have alleviated the problem using always a NavigationBar, but the problem still persists if I put the device in landscape mode.

Does someone know how to apply extra margins if necessary with the iPhone X?

Thanks!

Viewing all 91519 articles
Browse latest View live


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