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

Load web request data only once

$
0
0

Hi guys

I have a page, and on its viewmodel I have a task to asynchronous load information via a web request. I deserialize and populate my ObservableCollection, and display this list on my page. But when I navigate away from said page and return, my observableCollection is empty.

How can I persist this collection so I don't have to request the data everytime I navigate to that page?

Thanks in advance.


Simulate press home button by code

$
0
0

Is there any approach to simulate press home button by code with cross platform?
Thanks in advance

How to hide the status bar in AppCompat

$
0
0

I can't seem to do this. I created a new project with the latest pre-release (2.3.0.46-pre3) and tried the following:

NavigationPage.SetHasNavigationBar(this, false);

RequestWindowFeature(WindowFeatures.NoTitle);
Window.AddFlags(WindowManagerFlags.Fullscreen);
global::Xamarin.Forms.Forms.SetTitleBarVisibility(Xamarin.Forms.AndroidTitleBarVisibility.Never);

I still see a blue strip at the top even though its text is gone.

How to change the Status Bar Style ?

$
0
0

I've a Page and from that page I just jump to other page like Page 1====>Page 2
by using that code ...

            NavigationPage ppNav = new NavigationPage(new HtmlPage("PrivacyPolicy.html", Constants.PRIVACY_POLICY, true));
            ppNav.BarTextColor = Color.White;
            this.Navigation.PushModalAsync(ppNav);

Well I want a White Status Bar Icon in my app.
The problem is when I set BarTextColor to white then every thing works perfect but the Navigation Bar Title turns White and when I set BarTextColor to some other color then the status bar changes to black color .. What's the solution of this ? Also don't say to use a PushAsync...

SQLite: I lose the foreign key when I update children in object with other foreign key

$
0
0

OBJECTS
I'am using SQLite.NET-PCL and SQLiteNetExtensions

`public class Object1
{
[PrimaryKey, AutoIncrement]
public int id { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
    public List<Object2> ListObject2 { get; set; }

    [OneToMany(CascadeOperations = CascadeOperation.All)]
    public List<Object3> ListObject3 { get; set; }

}`

`public class Object2
{
[PrimaryKey, AutoIncrement]
public int id { get; set; }

    [ForeignKey(typeof(Object1))]
    public int object1_id { get; set; }
    [ManyToOne(CascadeOperations = CascadeOperation.All)]
    public Object1 Object1 { get; set; }

[OneToMany(CascadeOperations = CascadeOperation.All)]
    public List<Object3> ListObject3 { get; set; }

}`

`public class Object3
{
[PrimaryKey, AutoIncrement]
public int id { get; set }
public string name {get; set;}

[ForeignKey(typeof(Object2))]
    public int object2_id { get; set; }
    [ManyToOne(CascadeOperations = CascadeOperation.All)]
    public Object2 Object2 { get; set; }


    [ForeignKey(typeof(Object1))]
    public int object1_id { get; set; }
    [ManyToOne(CascadeOperations = CascadeOperation.All)]
    public Object1 Object1 { get; set; }

}`

this update works:

Object1.ListObject2 = Object2List;
 connection.UpdateWithChildren(Object1);

then I do

Object2.ListObject3 = Object3List;
 connection.UpdateWithChildren(Object2);

When i update object2 with children, Object2.object1_id is 0, I lose the foreign key with Object1.

Any idea? Whats is my problem? What 's the error?

Unless I use ModernHttp, my app is always deadlocked at the end.(Xamain.Forms-iOS)

$
0
0

I'm making app with using Xamarin.forms pcl.

Unless I use ModernHttp, my app is always deadlocked at the end.(Xamain.Forms-iOS). It works fine for a while, but few hours later, every 'await' call does not back to its place. This is a deadlock, isn't it?

My app has tons of http request call and it could be called at the same time sometimes.

This is very weird and serious problem for my app.

The problem is ModernHttp is out of date, which means the creator doesn't update library anymore. Maybe because of that, I'm experienced some problem with using ModernHttp. For example, UriImageSource sometimes does not load the image from web. (Works fine with built-in HttpClient)

Any tip for me?

Bluetooth Low Energy only 1 service

$
0
0

Hi everyone

In my application the user can connect to a Punchthrough Bean-device. Usually these devices have in total 10 services, but for some reason my application can only discover 1 service, both in Android and iOS.

How is this possible?

FYI I'm using the Bluetooth-code from Robotics Monkey.

How to turn switch off from c#

$
0
0

How can I turn a switch off from C# code behind xaml page?


Xamarin Forms startup times are unusably slow

$
0
0

My startup screen shows two buttons and a label in a StackLayout, and does nothing more. I've timed the app to take 2.5~3.0 seconds just to show that screen, in Release mode, on an actual device (Motorola Mini XT1030). That's an absurd and unacceptable amount of time to show nothing to the user. As far as I can tell, there's no way to show a splash-screen during that initial loading.

Yes, I'm using [assembly: XamlCompilation(XamlCompilationOptions.Compile)] (without it startup times are around 4.2s!). Running Xamarin Profiler, I see that 100% of the startup code is out of my control.

Is there anything else I can do to speed up my startup times? Or is Xamarin Forms really still not production-ready, and I should start recreating all my UIs on every platform?

Can you have dynamic cell heights with either the ListView or TableView views?

$
0
0

Can you have dynamic cell heights with either the ListView or TableView views?

NameResolutionFailure error in android device whereas working on windows device

$
0
0

Unable to fetch data in Xamarin.Forms project on android. Getting NameResolutionFailure error.
Same code working on windows device. Using SharePoint services

CachedImage FFImageLoading for Xamarin.Forms

$
0
0

https://github.com/molinch/FFImageLoading or https://github.com/daniel-luberda/FFImageLoading/ (new Forms features)

DEMO: https://github.com/daniel-luberda/FFImageLoading/tree/master/samples/ImageLoading.Forms.Sample

Caching support

The library automatically deduplicates similar requests: if 100 similar requests arrive at same time then one real loading will be performed while 99 others will wait. When the 1st real read is done then the 99 waiters will get the image.

Both a memory cache and a disk cache are present.

By default, on Android, images are loaded without transparency channel. This allows saving 50% of memory since 1 pixel uses 2 bytes instead of 4 bytes in RGBA (it can be changed).

WebP support

WebP is supported on both iOS and Android.

Downsampling

Downloaded images can be automatically downsampled to specified size (less memory usage). DownsampleHeight and DownsampleWidth properties

Retry

Downloads can be repeated if not succeeded: RetryCount and RetryDelay properties.

Placeholders support

  • LoadingPlaceholder

  • ErrorPlaceholder

image image

After this pull it'll also support Transformations!
https://github.com/molinch/FFImageLoading/pull/47

Transformations support

It doesn't modify original source images. Example:

  • RoundedTransformation

  • CircleTransformation

  • GrayscaleTransformation

image image

... and some more features. Feel free to test it. Not all features are on nuget yet (older version).

How to Center a Layout inside another Layout?

$
0
0

So I have Two Layouts . Relative and Stack. Stack is the Child of Relative. So I want to vertically center the Stack relative to the Parent Layout. How to do it?

ListView with own Model and List

$
0
0

Dear Forum,

sorry for my english. I have follow class as model:

class AddressField
{
public FieldName { get; set; }
public FieldValue { get; set; }
}

class ModelAddress
{
public List Fields { get; set; }
public int Id { get; set; }
}

in my ListView-Code I set the ItemTemplate:

ListView list = new ListView();
list.ItemTemplate = new DataTemplate(() => {
Grid grid = new Grid();

Label labelId = new Label();
labelId.SetBindung(Label.TextProperty, "Id"); // It works

grid.Children.Add(labelId);

Label labelAddressField = new Label()
labelAddressField.SetBinding(Label.TextProperty, "FieldName"); // Not work

grid.Children.Add(labelAddressField);

return new ViewCell() { View = grid });
}

I don´t understand, why the binding not works.

Greeting
Patrick

google Map Styling


How to get current item in ItemTemplate

$
0
0

I set template for item listview and assign list items

Page where I define listview:

         listView.ItemTemplate = new DataTemplate(typeof(CustomTemplateClass));
         listView.ItemsSource = posts;

How to get current item in ItemTemplate(CustomTemplateClass);

CustomTemplateClass.class:

            var postImage = new Image
        {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.FillAndExpand
        };
        postImage.SetBinding(Image.SourceProperty, new Binding("Images[0]"));
        var postImage = new Image
        {
            HorizontalOptions = LayoutOptions.FillAndExpand,
            VerticalOptions = LayoutOptions.FillAndExpand
        };
    postImage.SetBinding(Image.SourceProperty, new Binding("Images[1]"));

I want to get amount of Images from current item( like this currentItem.Images.Count) in ItemTempalte. Images it is simply list of strings. How to get currentItem?
p.s.All value in ItemTemplate I get by binding.

Visual Studio Erro

$
0
0

Severity Code Description Project File Line Suppression State
Warning IDE0006 Error encountered while loading the project. Some project features, such as full solution analysis for the failed project and projects that depend on it, have been disabled. AluraAPP.iOS.

I using Xamarin.form

I already reinstalled the visual studio and xamarin vs, but this error to be continued.

someone has gone through this error ??

i need help.

Similar ListView - XamarinForms

$
0
0

Is there something that can load data as a ListView?, what I need is to have horizontal scroll, because the ListView will not allow me...

Its for Xamarin Forms.

Apply Style to Listview control in Xamarin Forms.

$
0
0

Hi Friends,

Can anybody tells me how to apply style to Listview control in Xamarin Forms?

Thanks,
Prashant N

Android Application only displays white screen, iOS works perfectly

$
0
0

I'm experiencing odd behavior after updating some packages (like ReactiveUI 7, Xamarin Forms, SQLitePCL) and after replacing Akavache with my own SQLite implementation. I followed the instructions from Xamarin's documentation to install SQLite-net PCL.

Here's what's happening
The iOS version of the application works just as expected. The Android version launches and definitely executes my a Xamarin Forms application. If I set a breakpoint I can step through execution and see that my data has been successfully fetched from the server and from SQLite. I can step through my application, following execution to completion, yet my display remains white. This is true on both Android device and on the Android simulators.

I do not receive and errors during this process but I do get a lot of activity to my Application Output window which I've save to a gist:
Output Gist

Again, everything works perfectly on my iOS device and I haven't really edited the .iOS & .Droid applications other than to add renderers.

Has anyone dealt with this issue before? Thanks in advance.

**Dependencies **

Viewing all 91519 articles
Browse latest View live


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