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

How to remove top margin/padding on TableView?

$
0
0

I have a stack layout with 3 items stacked vertically. The middle item is a TableView. This is the TableView:

        return new TableView
        {
            Intent = TableIntent.Menu,
            Root = new TableRoot ("Profile")
            {
                new TableSection (App.FacebookProvider.GetCurrentUserName())
                {
                    inboxCell,
                    new ExtendedTextCell
                    {
                        Text = "Favorites",
                        ShowDisclousure = true
                    },
                    new ExtendedTextCell
                    {
                        Text = "Posts",
                        ShowDisclousure = true
                    },
                    new ExtendedTextCell
                    {
                        Text = "Album Invites",
                        ShowDisclousure = true
                    },
                },
            },
            BackgroundColor = Color.Transparent
        };

There is a margin at the top of the TableView by default that I want to remove. If you see the attached screenshots you can see the desired layout and the current layout with the extra margin. The TableView is scrollable so I just scrolled it to get the desired layout.


Create a Library to be consumed by the PCL

$
0
0

Hello all,

I guess this is a very basic question, but I'm not sure about the answer.
I have a Xamarin Forms app wich obviously has a PCL library, now I want to create a Library wich will have the Entities (Person, Costumer, and so on...) that will be common to the Android and to the iOS platform (if dependency service is needed).

Should I create a normal C# Class Library or a Class Library (Xamarin.Forms)?

Any ideas?

publish IOS inhouse

$
0
0

Has anyone got a good tutorial on how to publish a Xamarin.Forms app so that I can the distribute it in house?

Thanks

Device Info Plugin Id property length...

$
0
0

Hey guys, I am going to use the Id from the Device Info Plugin....
I am using SQLite ORM and wondered if you could tell me if the length will be the same so I can set the length attribute in the model class.

Thanks

AutomationId shows as an id in iOS but as a label in Android, is this intentional?

$
0
0

When we add AutomationId's to our forms and run REPL, iOS shows the id marked as id, whereas Android shows it marked as label.
This makes it tough to have common UITest code for both.
You can still use x.Marked, but the purpose of using the Ids was to delineate from actual text on the page.

Is this intentional or a by product of Android?
Or are we using AutomationId incorrectly?

3D Touch in forms (including peek/pop!)

TapGestureRecognizer doesn't fire if the tapped area is overlapped by BoxView?

$
0
0

Consider the following code

<Grid>
    <Grid.ColumnDefinitions>
        <ColumnDefinition Width="*"/>
        <ColumnDefinition Width="*"/>
    </Grid.ColumnDefinitions>
    <Grid.GestureRecognizers>
        <TapGestureRecognizer Tapped="Grid_Tapped" />
    </Grid.GestureRecognizers>
    <BoxView BackgroundColor="Green"/>
</Grid>

If I tapped on the first column, i.e. Green color area, the tapped function won't be invoked.
But if I tapped on the second column (or any other area not covered by the BoxView, the tapped function will be invoked.

Is this expected behaviour?

Xamarin.Forms 2.2.0.31, Android project running on VS Emulator

How to populate an image in a ListView if the image's URL is authenticated

$
0
0

It is easy to populate an image in a listview when the URL to that image is open: Use binding to set the image source to the image URL. But with a an authenticated URL, the image fails load.

If the image was not in a list view you could easily populate it with code, but there seems to be no way to address the image in the Init or Appaearing methods.

I'd like to use XAML for the layout. Is there a way to do this. Otherwise I will have to build the view in C# so that I can address those image cells.


Hamburger menu

$
0
0

Hi guys, please, is there any easy way how change standard behavior of hamburger menu (master/detail page) in the way that a menu page is covering whole height of screen? Typical behavior is that menu page is rendered below upper title section. Thanks a lot for any hints.

Add Badge to TabbedPage

$
0
0

I haven't found a way to add a Badge to TabbedPage in Xamarin.forms.
Although it's just one line code in xamarin.ios: UINavigationControllerTab1.TabBarItem.BadgeValue = "new value";
Anyone could provide me with an example? a simple example with the ability of updating the badge value is sufficient.

Thank you in advance.

gif doesnt work in image

$
0
0

Is it not possible to bind a gif ? is it not working on XF?

 <Image Source="test.gif" />

GIF in WebView - not showing up

$
0
0

Hey I have this simple HTML in a webview:

<html>
    <body>
    <img src="http://media4.giphy.com/media/ypqHf6pQ5kQEg/100.gif" style="border-radius:5px;width:91px;height:100px"></body>
    </html>

It always shows me a broken image link. I've tried it in a normal browser and it shows up fine. I also uploaded that HTML to my server and tried pointing the webview there directly. Still nothing.

Any ideas? Is anybody able to see that GIF from their app?

Will we see threads for new versions of XF or should we follow GitHub?

$
0
0

There is no thread for 2.3.0. Does that mean we won't see any in the future?

Problems with Application.Current.Properties...

$
0
0

Hi all

I have XF 1.3.0.6286-Pre-4 installed.
With an earlier version of XF (1.3.0 Pre-release 1 without documentation), I have (not successfully -> app-crashes) tried, to store application-settings persistent via Application.Current.Properties….).
Now, I want to implement it correct according to the (small) documentation:
developer.xamarin.com/guides/cross-platform/xamarin-forms/working-with/app-lifecycle/#Properties_Dictionary

Problem-description:
As soon as I want to access the Properties, the app (on WP) crashes with “System.AccessViolationException - Attempted to read or write protected memory. This is often an indication, that other memory is corrupt”.
The crash happens by code-line:

if (!Application.Current.Properties.ContainsKey("iWebServerAuswahl"))

(note: the app also crashes on Android as soon as I activate the “if”)

If the key is found, I then want to overtake the value in an integer (public) variable.
If the key is not found I then want to set the key (and the public variable) with a default-variable.
However, as I wrote, the app crashes already by the If-statement (before I can read/write the value).

First, I thought that there are some permissions missing (in WMAppManifest.xml)...
However, I don’t see special permissions to that theme...

I think, the file/whatever in which the settings are stored, is corrupt (as negative side effect from my earlier tests).

Now I want to clear/delete the settings (file).

Strange wise, it don’t help, if I remove the whole app manually from the WP-Device (Lumia 930) and deploy it once again… so - for me - it looks like a problem in my project.

How can solve this problem?

Thanks for any feedback

iOS IPA file going into subfolder with "AssemblyName yyyy-MM-dd HH-mm-ss"

$
0
0

Hey there friends,

using latest code (details below), our jenkins build last step is failing, as the IPA file goes into a subfolder now.
anyway to disable this?

After a successful build, this is what I get:

drwxr-xr-x   3 codeknox  staff      102 May 26 16:49 AssemblyNameXYZ 2016-05-26 16-49-02

and the IPA file is inside this folder.

Here is version details:

=== Xamarin Studio Business ===

Version 6.0 (build 5166)
Installation UUID: 0a2578d7-b1f5-40ce-a518-cb5925d60c29
Runtime:
    Mono 4.4.0 (mono-4.4.0-branch/67b89ea) (64-bit)
    GTK+ 2.24.23 (Raleigh theme)

    Package version: 404000176

=== Xamarin.Profiler ===

Not Installed

=== Xamarin.Android ===

Version: 6.1.0.69 (Xamarin Business)
Android SDK: /Users/sibagy/Library/Developer/Xamarin/android-sdk-mac_x86
    Supported Android versions:
        2.3   (API level 10)
        4.0.3 (API level 15)
        4.1   (API level 16)
        4.4   (API level 19)
        5.0   (API level 21)
        6.0   (API level 23)

SDK Tools Version: 25.1.6
SDK Platform Tools Version: 23.1
SDK Build Tools Version: 23.0.3

Java SDK: /usr
java version "1.7.0_71"
Java(TM) SE Runtime Environment (build 1.7.0_71-b14)
Java HotSpot(TM) 64-Bit Server VM (build 24.71-b01, mixed mode)

Android Designer EPL code available here:
https://github.com/xamarin/AndroidDesigner.EPL

=== Xamarin Android Player ===

Not Installed

=== Xamarin Inspector ===

Version: 0.8.0.0
Hash: dc081aa
Branch: master
Build date: Tue Apr 26 23:07:44 UTC 2016

=== Apple Developer Tools ===

Xcode 7.3.1 (10188.1)
Build 7D1014

=== Xamarin.iOS ===

Version: 9.8.0.319 (Xamarin Business)
Hash: 7b89851
Branch: cycle7
Build date: 2016-05-20 16:56:02-0400

=== Xamarin.Mac ===

Not Installed

=== Build Information ===

Release ID: 600005166
Git revision: ec4f06cfaa9debdca2539e19edeafffe88ccd0cc
Build date: 2016-05-20 18:51:15-04
Xamarin addins: c7761d054f38e9a210822aba6356398af0c36fa9
Build lane: monodevelop-lion-cycle7

=== Operating System ===

Mac OS X 10.11.5
Darwin maui.local 15.5.0 Darwin Kernel Version 15.5.0
    Tue Apr 19 18:36:36 PDT 2016
    root:xnu-3248.50.21~8/RELEASE_X86_64 x86_64

=== Enabled user installed addins ===

Xamarin Inspector 0.8.0.0

SOAP webservice used to work, but now it doesn't work on any device below Android 6.0 - Help!

$
0
0

Suddenly i got reports form user that a list in my app didn't show any data - It worked fine on my device. Later i found out that everything works fine and dandy on all android devices with 6.0 installed - every android version below 6.0(Marshmallow), wont get data transferred! I am at a loss - have no idea what has happened or how to fix this.... HALP!

Does any1 recognize this or have possible solution to how this can be fixed?

In my forms app i have a portable library where i have a class handling the SOAP webservice, it is implemented like below:

    //private Uri baseUri = new Uri("uri");
    private static DataConnection _instance = null;
    private HttpClient client = null;

//Contructor
    private DataConnection()
    {
        client = new HttpClient(new NativeMessageHandler());
        client.BaseAddress = baseUri;
    }
    public static DataConnection Instance { get { if (_instance == null) _instance = new DataConnection(); return _instance; } }

    public async Task<Other.ServiceResponse> RefreshRouteList()
    {
        try
        {
            var soapString = this.constructRefreshsoap();
            client.DefaultRequestHeaders.Clear();
            client.DefaultRequestHeaders.Add("SOAPAction", "https://trolderuterne.play2know.dk/GetRoutes");
            var content = new StringContent(soapString, Encoding.UTF8, "text/xml");

            using (var response = await client.PostAsync("/Classes/mobileServices.asmx", content))
            {
                if (response.IsSuccessStatusCode)
                {
                    var soapResponse = await response.Content.ReadAsStringAsync();
                    return JsonConvert.DeserializeObject<Other.ServiceResponse>(ParseSoapResponse(soapResponse));
                }
                return new ServiceResponse { Code = Codes.ServerError, Message = response.StatusCode.ToString() };
            }
        }
        catch (Exception ex)
        {
            return new ServiceResponse
            {
                Code = Codes.ServerError,
                Message = ex.Message
            };
        }
        finally
        {
        }
    }

Modal View on tabbed page

$
0
0

Hello, all.

I'm trying to place a view inside a tabbed page on Xamarin.Forms.

The only problem is that the view is not covering the tabs from the Tabbed Page. That's expected because the view is being called from the content page that the tabbed view holds.

Have any of you faced something like this? I've attached a screen to facilitate.

Thanks,
Fernando Rocha

Async and await: UI thread is blocked

$
0
0

Hi,

I have this architecture in my project and sometimes UI thread is getting blocked, can someone please explain what is happening with the below code. Thanks

I am making a service call asyncronously from xamarin.forms viewmodel

Following is the flow

View--->ViewModel---ClassA--->ClassB--Make a service call from here

Code

Scenario 1

public partial class HomePage : ContentPage
{
    private HomeVM model;

    public HomePage()
    {
        InitializeComponent();
        model = new HomeVM();
        model.MainText = ReturnBool().Result;
        this.BindingContext = model;
    }
    public async Task<string> ReturnBool()
    {
        IsBusy = true;
        var r = await new WS().ReturnBool();
        IsBusy = false;---------------------------------------Not hitting the breakpoint here
        return r;
    }
}

public interface IWS
{
    Task<string> ReturnBool();
}

public class WS : IWS
{
    public Task<string> ReturnBool()
    {
        return ServiceOperations.ReturnBool();
    }
}

internal class ServiceOperations
{
    public async static Task<string> ReturnBool()
    {
        var uri = new Uri(string.Format("http://testmyapi.azurewebsites.net/", string.Empty));
        try
        {
            HttpClient client = new HttpClient();
            client.BaseAddress = uri;
            HttpResponseMessage response = null;
            response = await client.GetAsync("/api/Values/Get");
            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();
                string str = JsonConvert.DeserializeObject<string>(content);
                return str;
            }
            else {
                return null;
            }
        }
        catch (Exception)
        {
            return null;
        }
    }
}

Scenario 2

public partial class HomePage : ContentPage
{
    private HomeVM model;

    public HomePage()
    {
        InitializeComponent();
        model = new HomeVM();
        this.BindingContext = model;
    }
}

public class HomeVM : BaseVM
{
    private string mainText;

    public string MainText
    {
        get { return mainText; }
        set
        {
            mainText = value;
            RaisePropertyChanged("MainText");
        }
    }

    public HomeVM()
    {
        MainText = ReturnBool().Result;
    }

    public async Task<string> ReturnBool()
    {
        IsBusy = true;
        var r = await new WS().ReturnBool();
        IsBusy = false;---------------------------------------Not hitting the breakpoint here
        return r;
    }
}


public interface IWS
{
    Task<string> ReturnBool();
}

public class WS : IWS
{
    public Task<string> ReturnBool()
    {
        return ServiceOperations.ReturnBool();
    }
}

internal class ServiceOperations
{
    public async static Task<string> ReturnBool()
    {
        var uri = new Uri(string.Format("http://testmyapi.azurewebsites.net/", string.Empty));
        try
        {
            HttpClient client = new HttpClient();
            client.BaseAddress = uri;
            HttpResponseMessage response = null;
            response = await client.GetAsync("/api/Values/Get");
            if (response.IsSuccessStatusCode)
            {
                var content = await response.Content.ReadAsStringAsync();
                string str = JsonConvert.DeserializeObject<string>(content);
                return str;
            }
            else {
                return null;
            }
        }
        catch (Exception)
        {
            return null;
        }
    }
}

It would be great if anyone explains why UI thread is getting blocked.

List view Cell Tapping functionality like iOS

$
0
0

HI ,

I used the list view and using ImageCell in XF , How can i do a cell functionality with each index and If I selected first index will showcase some UIView and If i change the index how can I showcase another view.

First time I'm coming from home screen in this list view screen so Initially how can i set first index action and how can i showcase one UIView initially ??

For more info pls find the attached file :

How to expand picker height vertically

$
0
0

I have a Picker in my app, this has a list of product options. one of my product name is too large and this is not Fit in picker. is it possible to expand the text vertically if it reaches picker width?

Viewing all 58056 articles
Browse latest View live


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