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

Change RowHeight property on runtime

$
0
0

Hi guys!

I have a Slider and ListView on may page, Slider changing RowHeight property, but the list updates the height of cells only when drawing new cells. Is there a way to invoke these cells again, or how can I instantly change the RowHeight property?


Add badges Count in the navigation bar using Xamarin Forms

How to implement RadioBox Control in Xamarin Forms (Android,iOS) ?

$
0
0

Hi, I have to implement radio box controls in xamarin forms as shown in the picture above. Since we don't have any control like that in xamarin forms, Can somebody help me how do we implement this into Xamarin.Forms (To target iOS and Android) ?
Thanks

Memory leak with simplest back/forth navigation in Forms Android App

$
0
0

I'm investigating a memory leak (or leaks) which seem to be core to our Forms app.

We're using FreshMvvm, which previously had a pretty bad leak due to Pages/PageModels not being garbage collected. Michael Ridland (FreshMvvm) author) fixed that, which is great.

However, we're still seeing the figure returned by GC.GetTotalMemory() steadily increase. It does decrease, but the general trend is upwards.

I've stripped things right back so that I've just got a plain Page which pushes another page and we can then pop back to the first.

Doing this, I'm seeing GC.GetTotalMemory() generally increase by 2K - 4K every cycle. This is after forcibly calling GC.Collect();

We're running Xamarin.Forms 2.3.4.270 - I know this is quite old, but we really don't want to upgrade as we don't want to introduce 'new Forms' bugs! However, I have tried experimentally upgrading to 2.5.0.121934, and I see the same behaviour (as well as aspects of the app stop working with this version).

Short of using Profiler, are there any investigative techniques I can use to find the culprit?

My next step will be to strip more and more out!

Error CS0246: The type or namespace name 'Xamarin' could not be found

$
0
0

Why i am getting error in new generated Project (Xamarin.Forms Project)?
Error CS0246: The type or namespace name 'Xamarin' could not be found (are you missing a using directive or an assembly reference?) (CS0246)

How to implement In-App Purchase in Xamarin.Forms

$
0
0

I searched but couldn't find correct implementation. Please help.

Thanks

How to make in-app purchasing in cross platform application?

$
0
0

Hello All,

I am trying to implement InApp purchasing from iOS & Android app.

I followed this link. But not getting success.

Please comment your code/ideas.

Refresh ui from a loop in the viewmodel

$
0
0

I have a loop in my viewmodel which cycles through random dice rolls. It works fine updating the dice for the final numbers, but I really want the dice images to cycle along with the rolls so that the user can see every number. The problem is, the command doesn't return to the Ui until the final number is bound.

How can I refresh the Ui and show the bound images during the loop?

Here is the appropriate section of code:

RandomTimes = new Random();
RandomDiceRoll = new Random();
iteration = RandomTimes.Next(25, 40);

        for (int j = 0; j < iteration; j++)
        {

            for (int i = 0; i < Dice.Length; i++)
                Dice[i] = RandomDiceRoll.Next(1, 6 + 1);

            if (!Die1Saved)
            {
                Die1 = Dice[0];
                DiePic1 = DiceImages[Dice[0]];

            }
            if (!Die2Saved)
            {
                Die2 = Dice[1];
                DiePic2 = DiceImages[Dice[1]];

            }
            if (!Die3Saved)
            {
                Die3 = Dice[2];
                DiePic3 = DiceImages[Dice[2]];

            }
            if (!Die4Saved)
            {
                Die4 = Dice[3];
                DiePic4 = DiceImages[Dice[3]];

            }
            if (!Die5Saved)
            {
                Die5 = Dice[4];
                DiePic5 = DiceImages[Dice[4]];

            }

//REFRESH THE UI SOMEHOW!!!!
}


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.

what will be the best architect or design pattern for new application

$
0
0

Hi,

Our current application has been developed on iOS platform but we are facing problem when there's launch new iOS.
So, we decide to move on xamarin.
But right now we want to move on xamarin where our application will be run on android and iOS,
But we need some advise about architect or design pattern.

Note: what will be the best machine for development mac or windows

ListView item images misplacing and disappear sometimes while scroll up/down in Xamrin.Form

$
0
0

Hello

I have read few blogs but didn't find solution of it.

When I scroll Up/Down, some image misplace and some image disappear. I have review my code and given enough time to get rid of the problem. But unfortunately I didn't find any way to resolve this.

Can anybody please guide me? I check with iOS.

EmployeeResultsPage

<ListView x:Name="EmployeeResultsListView"
          ItemsSource="{Binding EmployeeResults}"
          RowHeight="200"
          IsPullToRefreshEnabled="true"
          RefreshCommand="{Binding RefreshDataCommand}"
          IsRefreshing="{Binding IsRefreshingData, Mode=OneWay}"
          ItemAppearing="Employee_ItemAppearing"
    <ListView.ItemTemplate>
        <DataTemplate>
            <local:EmployeeResultViewCell />
        </DataTemplate>
    </ListView.ItemTemplate>
</ListView>

EmployeeResultsPage.CS

private void Employee_ItemAppearing(object sender, ItemVisibilityEventArgs e)
{
    var itemObject = e.Item as ExtendedEmployee;
    if (_viewModel.EmployeeResults.Last() == itemObject)
    {
        if (_viewModel.LoadEmployee.CanExecute(null))
        {
            _viewModel.LoadEmployee.Execute(null);
        }
    }
}

EmployeeResultViewModel

[ImplementPropertyChanged]
public class EmployeeResultsViewModel : ViewModelBase
{
    private async Task LoadEmployee()
    {
        EmployeeResults = GetDataUsingAPI(); //15 records per call
    }

    public ObservableRangeCollection<ExtendedEmployee> EmployeeResults { get; set; }

    public string EmployeePhotoUrl { get; set; }
    public string EmployeeName { get; set; }
}

EmployeeResultViewCell

<ViewCell.View>
    <Grid RowSpacing="0" ColumnSpacing="0" VerticalOptions="Center" HeightRequest="150">
        <Image x:Name="EmployeeImage" Grid.Column="0" HeightRequest="150" WidthRequest="150"
        Source="{Binding EmployeePhotoUrl}" />
        <Label Text="{Binding EmployeeName}" FontSize="18" TextColor="Grey"/>
    </Grid>
</ViewCell.View>

CS File

public partial class EmployeeResultViewCell : CustomViewCell
{
    public EmployeeResultViewCell()
    {
        InitializeComponent();
    }

    protected override void OnBindingContextChanged()
    {
        base.OnBindingContextChanged();
        var employee = (BindingContext as ExtendedEmployee);
    }
}

XAMARIN Forms and AZURE

$
0
0

Hey guys,

Ok so I have created a wonderfull app using sqlite, now I am planing to moving the database side of things to AZURE. So I create the AZURE sql database, all the tables I need, happy....now I think how do I connect, surely this must be easy.......

Ok so look at AZURE mobile app, create easy tables that have the same name as the tables I made previously. Thinking this looks promising.

Can see how to connect etc.....

But now I want to query these tables...... cant seem to see anyway to call stored procedures or views or even create joins between tables.

So my question is

whats the best way to connect to a azure database for a cross platform Xamarin Forms app that allows for normal queries or stored procedure calls.

:)

Consuming REST services

$
0
0

What is the best method for consuming REST services which are locally deployed? I am specifically having issues with utilizing HTTPS for iOS. When calling the web service from iOS (the iPhoneSimlator), I receive a "TrustFailure" web exception. I think this is because the certificate used is self-signed (it's not secure because I am using my internal IP address and the certificate is issued for localhost) when using IIS Express. Does this mean I need to "publish" my API to IIS (or Azure) and use a valid certificate in order to consume the service? This seems like a lot of work for development, especially since I am creating the REST service and mobile application at the same time.

My development environment is:

I have reviewed this and this, but neither really touch on this issue. Any advice on a streamlined workflow would be much appreciated.

Is there support for SearchBar on nougat 7.0?

$
0
0

Uploaded a build to test cloud which passed on multiple devices and android versions. However the 7.0 device failed because the screen didn't render my search bar.

    <ContentPage.Content>
        <StackLayout Orientation="Vertical" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
            <StackLayout.Padding>
                <Thickness>
                    4, 0, 4, 0
                </Thickness>
            </StackLayout.Padding>

            <SearchBar x:Name="txtSearch">
            </SearchBar>

            <ListView x:Name="listCountries">
                <ListView.ItemTemplate>
                    <DataTemplate>
                        <ImageCell Text="{Binding description}" TextColor="Black" ImageSource="{Binding flag, Converter={StaticResource base64ToImageSource}}" />
                    </DataTemplate>
                </ListView.ItemTemplate>
            </ListView>
        </StackLayout>
    </ContentPage.Content>

SearchBar simply did not appear on the screen of the 7.0 device (specifically, LG Nexus 5X running Android 7.0). Is this an issue with the OS or with XF?

I've attached some images - one is a working example on a 6.0.1 device, the other shows the missing searchbar on 7.0.

Thanks,

JWF

Error Java.Lang.OutOfMemoryError: Failed to allocate a 132710412 byte allocation with 1048576

$
0
0

Hi everyone, I've been working in my solution in shared project, and I´ve this error when I run my solution on a Samsung Galaxy S6 and S5 only, I'm testing my app and my solution on emulators of differents devices (Galaxy S3, LG G2, Nexus 5, Nexus 4, and google galaxy nexus) all of them in resolutions of 720x1280, 1080x1920, and with android version between 4.0 and 6.1, and all of them run without problem just with Galaxy S5 and S6 . I've seen that the problem is about of the use of large images... but all the image that I use in my forms are in xaml like backgrounds and with the hightest resolution of 648x1152..

This is the error message:

** End of managed Java.Lang.OutOfMemoryError stack trace ---
java.lang.OutOfMemoryError: Failed to allocate a 132710412 byte allocation with 1048576 free bytes and 95MB until OOM
at dalvik.system.VMRuntime.newNonMovableArray(Native Method)
at android.graphics.BitmapFactory.nativeDecodeAsset(Native Method)
at android.graphics.BitmapFactory.decodeStream(BitmapFactory.java:609)
at android.graphics.BitmapFactory.decodeResourceStream(BitmapFactory.java:444)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:467)
at android.graphics.BitmapFactory.decodeResource(BitmapFactory.java:497)
at android.graphics.drawable.BitmapDrawable.updateStateFromTypedArray(BitmapDrawable.java:762)
at android.graphics.drawable.BitmapDrawable.inflate(BitmapDrawable.java:724)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1215)
at android.graphics.drawable.LayerDrawable.inflateLayers(LayerDrawable.java:254)
at android.graphics.drawable.LayerDrawable.inflate(LayerDrawable.java:164)
at android.graphics.drawable.Drawable.createFromXmlInner(Drawable.java:1215)
at android.graphics.drawable.Drawable.createFromXml(Drawable.java:1124)
at android.content.res.Resources.loadDrawableForCookie(Resources.java:2630)
at android.content.res.Resources.loadDrawable(Resources.java:2540)
at android.content.res.Resources.getDrawable(Resources.java:806)
at android.content.Context.getDrawable(Context.java:458)
at com.android.internal.policy.PhoneWindow.generateLayout(PhoneWindow.java:3934)
at com.android.internal.policy.PhoneWindow.installDecor(PhoneWindow.java:3981)
at com.android.internal.policy.PhoneWindow.getDecorView(PhoneWindow.java:1969)
at android.app.ActivityThread.handleResumeActivity(ActivityThread.java:3160)
at android.app.ActivityThread.handleLaunchActivity(ActivityThread.java:2481)
at android.app.ActivityThread.-wrap11(ActivityThread.java)
at android.app.ActivityThread$H.handleMessage(ActivityThread.java:1344)
at android.os.Handler.dispatchMessage(Handler.java:102)
at android.os.Looper.loop(Looper.java:148)
at android.app.ActivityThread.main(ActivityThread.java:5417)
at java.lang.reflect.Method.invoke(Native Method)
at com.android.internal.os.ZygoteInit$MethodAndArgsCaller.run(ZygoteInit.java:726)
**
I'm a kind of confuse of why show this error only in that kind of divices..


Generating x amount of images in grid layout

$
0
0

Hi im making a tabbed page and one of the tabs will be a photo album. The photos will be retrieved from the database i am using (firebase). Is there a way to automatically organise photos from the database to look like a photo gallery?
Baring in mind sometimes there will only be 5 photos and sometimes there could be over 10.

Any pointers on how to do this would be greatly appreciated!

How to add content with tabbed page?

$
0
0

Here is my example :

How to create this tabbed page with top button?

Xamarin Form sharedsizegroup equivalent

$
0
0

There is in Xamarin Forms equivalent of wpf sharedsizegroup?

How to set Displayactionsheet with dynamic data?

$
0
0

Hi,

I am trying to create a displayactionsheet with dynamic data. My data are stored in local DB and which is now stored in an observablecollection. How can I set this observablecollection data to displayactionsheet options?

Thanks in advance :)

XAML intellisense stopped working after VS 15.6

$
0
0

I have 3 Xamarin projects, I just upgraded to VS 15.6 and now XAML intellisense is not working for one of the projects???

How do I fix this?

I have tried cleaning the solution, rebuilding.

The other two projects it works completely fine.

Viewing all 77050 articles
Browse latest View live


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