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

Switch not alligning in GridLayout

$
0
0

Hey guys, so I am developing a form based app which takes in user entries and displays it in a page. I use Grid Layout to display this information with two columns (Grid.Column= 0 & Grid.Column 1). This page consists of mostly labels and switches. This switch however doesn't align with the right hand side of the page that is Grid.Column 1. If I use Grid.Column 1 it positions itself at the end of the screen while if I use Grid.Column = 0, it positions itself right next to the question.

What can I do to fix this? I have tried changing different vertical options.
Thanks in advance!


Is Possible to create Azure mobile app communicate RoR Rest API For Data sync and Push Notification

$
0
0

We are creating xamarin mobile app and RoR(Postgre SQL) Web App. When Any data updated by Web app, it should sync with mobile and able to see the data in offline too. then, update some data from mobile (offline), then, after connected with internet, send Data from mobile to PostgreSQL using RoR Rest Service. For this, we plan to develop a normal mobile app, then By clicking the update button in mobile, it consumes RoR rest service, then Updates Mobile DB. Is it Right way? or Developing Azure Mobile app?. We are not much aware at this. Please put your ideology. thanks

MVVM Cross or Caliburn for Shared Xamarin Project VS2017

$
0
0

I'm trying to set up either MVVMCross or Caliburn in my Shared Xamarin project in VS2017, but I cannot do it.. There are a lot of tutorials how to do it in Portable Class Library, but as it's no longer supported in VS2017, I want to set one of this frameworks up in Shared project. Does anyone know how to properly set up one of these frameworks? I didn't find a solution online.

GeoLocator for PCL

$
0
0

Hi, I try to use the GeoLocator plugin for PCL but when i call await locator.GetPositionAsync (timeoutMilliseconds: 10000); it never returns, I try also to get some infos on forum but nothing...
can you help me please? thank you in advance.

.What TODO just installed from scratch and i have a ERROR without changing the initial blank code.

$
0
0

Severity Code Description Project File Line Suppression State
Error The "XamlCTask" task could not be instantiated from "D:\BorisF\projects\xamarin\udemi\helloworld\packages\Xamarin.Forms.2.3.4.247\build\portable-win+net45+wp80+win81+wpa81+MonoAndroid10+Xamarin.iOS10+xamarinmac20\Xamarin.Forms.Build.Tasks.dll". Could not load file or assembly 'Xamarin.Forms.Build.Tasks, Version=0.0.0.0, Culture=neutral, PublicKeyToken=null' or one of its dependencies. Operation is not supported. (Exception from HRESULT: 0x80131515) HelloWorld.Android

New added file in PCL could not be found on driod and ios(namespace "Filename" could not be found)

$
0
0

As you can see in the picture, I've already added new folder named as "Data" including interface file, "ISQLite.cs".
However, when I tried to use it in iOS and android, it can't found any of that namespace "using TestProjectXamarin.Data;"

Off Topic Question: Facebook, Instagram and Twitter Demotions

$
0
0

Hi,

I want to ask about the Facebook, Instagram and Twitter header and footer (tab menu) sizes? and what's the icon size the use on both header and footer?

Any idea please?

Thanks,
Jassim

It is possible to send headers when calling a WebView?

$
0
0

I'm using a WebView that renders the login page of the web version of my app. I'm trying to send an access token via http header so when the WebView is called, users don't have to login again. The webapp is ready to get the token and redirects to the dashboard if it's present in the request headers.

Is it possible to send custom headers when callling a website with WebView?

Any advice or direction would be appreciated. Thank you :)


Custom Label renderer for HTML text

$
0
0

I'm trying to write a custom renderer for a Label to be able to use some HTML tags. I'm looking at an example I found, "Awesome Xamarin Forms Label with HTML Text Formatting", but I can't get it to work.
In Android I can change the text in my custom Label but without any HTML formatting. In iOS I can't change the text programmatically, only in XAML (but with the iOS simulator all other controls disappears!).
Any clues of what is wrong? Android code down below:

HtmlFormattedLabel.cs:

using Xamarin.Forms;
namespace TurfUserStatistics
{
    public class HtmlFormattedLabel : Label
    {
    }
}

Android HtmlFormattedLabelRenderer.cs:

using Android.Content;
using Android.Text;
using Android.Widget;
using TurfUserStatistics;
using TurfUserStatistics.Droid;
using Xamarin.Forms;
using Xamarin.Forms.Platform.Android;
[assembly: ExportRenderer(typeof(HtmlFormattedLabel), typeof(HtmlFormattedLabelRenderer))]
namespace TurfUserStatistics.Droid
{
    public class HtmlFormattedLabelRenderer : LabelRenderer
    {
        public HtmlFormattedLabelRenderer(Context context) : base(context)
        { }

        public static void Initialize()
        { }

        protected override void OnElementChanged(ElementChangedEventArgs<Label> e)
        {
            base.OnElementChanged(e);
            if (Control != null)
            {
                Control.SetText(Html.FromHtml(Element.Text.ToString()), TextView.BufferType.Spannable);
            }
        }
    }
}

Android MainActivity.cs:

using Android.App;
using Android.Content.PM;
using Android.OS;
namespace TurfUserStatistics.Droid
{
    [Activity(Label = "Turf User Statistics", Icon = "@drawable/icon", Theme = "@style/MainTheme", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {
        protected override void OnCreate(Bundle bundle)
        {
            TabLayoutResource = Resource.Layout.Tabbar;
            ToolbarResource = Resource.Layout.Toolbar;

            base.OnCreate(bundle);

        HtmlFormattedLabelRenderer.Initialize();
            global::Xamarin.Forms.Forms.Init(this, bundle);
            LoadApplication(new App());
        }
    }
}

Short version of XAML file:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage 
         xmlns:local="clr-namespace:TurfUserStatistics;assembly=TurfUserStatistics"
             x:Class="TurfUserStatistics.TUS_Main_Page"
             Title="Turf User Statistics" >
    <ContentPage.Content>
        <ScrollView>
            <StackLayout Padding="4">
            <local:HtmlFormattedLabel x:Name="labelTest" Text="htmltext" FontSize="14">
            </local:HtmlFormattedLabel>
             </StackLayout>
        </ScrollView>
    </ContentPage.Content>
</ContentPage>

And in XAML.cs file:

labelTest.Text = "<html><body><b>bold</b> - <i>italic</i> - <u>underline</u></body></html>";

cannot initialize list collection

$
0
0

Unable to cast object of type 'System.RuntimeType' to type 'Mono.Debugger.Soft.TypeMirror'. to _list

var _list= new ObservableCollection
{
new loginDetail{name="Rinshad",email="rinshad06@gmail.com",c_password="qwer"},
new loginDetail{name="rrr",email="rshad06@gmail.com",c_password="wwww"},
new loginDetail{name="laxman",email="laxman@gmail.com",c_password="laxmandddd"},
};
return _list;
}

plz help me out ASAP

Toolbar / ListView error

$
0
0

Hello,

I have a Toolbar in a XamarinForms page, 4 primary, 3 secondary items. Priority set on each too. No obvious issue.

When I run the app and try select one of the secondary items, I get a black popup but cannot see the menu items.

Anyone come across this:
Before Android 4.1, method int android.support.v7.widget.ListViewCompat.lookForSelectablePosition(int, boolean) would have incorrectly overridden the package-private method in android.widget.ListView

Thanks

Column for SQLite to a List

$
0
0

So I have got a SQL Table:

public class MyClass
{
    [PrimaryKey, AutoIncrement]
    public int Id { get; set; }
    public int Value { get; set; }
    public string Date { get; set; }
}

Now I want to get int values of "Value" of every element in the table and put it into a List of type . How to do that?

List entry = new List()
{
foreach(var number in _connection.QueryAsync("SELECT Value FROM MyClass", number))
{
new Entry(number);
}
}

After updating Xamarin I get referenced component *** could not be found

$
0
0

Hey everyone,
I've working on this for two days now straight.
After Updating Xamarin Forms Project
I can't build my Android App anymore. The error says the following:

Error This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see [cant post links...] The missing file is ..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.props Warning The referenced component 'Xamarin.Forms.Platform.Android' could not be found. Warning The referenced component '***' could not be found. (for all my references) 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. Warning "\packages\Xamarin.Forms.2.5.0.122203\build\netstandard1.0\Xamarin.Forms.props" cannot be imported again. It was already imported at "\RajaChat.Android\RajaChat.Android.csproj (3,3)". This is most likely a build authoring error. This subsequent import will be ignored.

I already tried the following (google) :

  • Deleting the package folder and let nuget restore restore the packets
  • Using nuget console with: "Update-Package –reinstall"
  • Clean Build and Rebuild with deleting obj and bin folders
  • Downgrade to Xamarin.Build.Download 0.4.6
  • Unload and Load the Android Project

Nothing helped, always the same output...

I turned on the TRACEDESIGNTIME for debugging the IDE0006 Error but it only gave me the same error as above in the .designtime.log:

D:\Dropbox\C, c++, c#\C#\Xamarin\RajaChat\RajaChat\RajaChat.Android\RajaChat.Android.csproj(308,5): error : This project references NuGet package(s) that are missing on this computer. Use NuGet Package Restore to download them. For more information, see . The missing file is ..\..\packages\Xamarin.Forms.2.5.0.121934\build\netstandard1.0\Xamarin.Forms.props.

Thanks in advance,
Max

Login With LinkedIn in Xamarin.Forms : Error Authenticating: Invalid_request Exception ?

$
0
0

Hello Everyone, I am implementing linkedin login with xamarin.auth. Please see screenshot for exception. I tried to put breakpoints but they are not hit and exception arises. Help me solve this please.

Push Notification for both iOS and Android

$
0
0

Hello,

I have a custom API running on my server and I want to show notifications to user based on data from the API. I have read other posts as well, But almost all of them use azure or firebase which in my case is not possible since My API is already up and running.

So, can you please point out any library or module which I might be able to use.


File "obj\Debug\android\bin\packaged_resources" does not exist

$
0
0

Hi, I have a Xamarin.Forms app and the Android project gives me this error: File "obj\Debug\android\bin\packaged_resources" does not exist.
I have enabled the diagnostic output and the last line before the error is "Processing: C:\Users\borto\Source\Repos\DreamInvest\DreamInvest.Mobile\DreamInvest.Mobile.Android\obj\Debug__library_projects__\Xamarin.GooglePlayServices.Basement\library_project_imports\res\values-zu\values.xml".
How can I resolve this problem or find the real error?

Xamarin forms ListView problem

$
0
0

Hi

I have shorty askt the same questing, but for some reason, the Discussion disappeared before I could read any response.

I'm working on a project where I have the following setup. I have an object that is has a "working" group. This object can also be friends with other groups.
The object can maximum have 10 friends. Total in the app it exists 40 groups. To select which groups to be friends with I have a listview with custom cells. The cells have only a label and a switch.

The group that the object belongs to cannot be selected disabled. And when 10 groups have been selected rest of the groups shall be disabled as well until a group has been deselected.

The problem occurs on iOS when 10 groups have been selected and the user scrolls away and the back. The most of the time the selected group don't react on touch. Just like if they are disabled. Sometimes it works, and the often only one time and the no more.

I have set the ListViewCachingStrategy. to RetainElement.

But on Android, it works as it should.

This drives me crazy.

Complex Binding example

$
0
0

Hello,
I'm thinking about the possibility of an application with a special binding based on XML Data we can receive from another application.
This is just something we have in mind and need to have a working example to proofe our idea.

Here is an example of an XML we could generate.

<DataSet>
    <Definition>
        <Interface>Interface01</Interface>
        <Context>Order</Context>
        <ContextAction>GET</ContextAction>      
    </Definition>
    <Data>
        <Header>
            <Actions>
                <Action name="Post" context="Order" contextaction="POST" />
            </Actions>
            <Fields>
                <field name="Document Type" value="Order" />
                <field name="Document No." value="ORDER00001" />
                <field name="Customer No." value="CUST001" editable="true" LookUpContext="Customer" LookUpAction="GET" />
                <field name="Customer Name" value="Customer Name" />
            </Fields>
        </Header>
        <Lines>     
            <Actions>
                <Action name="Show Info 1" context="LineInfo1" contextaction="GET" />
                <Action name="Show Info 2" context="LineInfo2" contextaction="GET" />
            </Actions>
            <Line>
                <field name="Column1" value="Column 1 Value Line 1" />
                <field name="Column2" value="Column 2 Value Line 1" />
                <field name="Column3" value="Column 3 Value Line 1" />
                <field name="Column4" value="Column 4 Value Line 1" />
                <field name="Column5" value="Column 5 Value Line 1" />              
            </Line>                     
            <Line>
                <field name="Column1" value="Column 1 Value Line 2" />              
                <field name="Column2" value="Column 2 Value Line 2" />
                <field name="Column3" value="Column 3 Value Line 2" />
                <field name="Column4" value="Column 4 Value Line 2" />
                <field name="Column5" value="Column 5 Value Line 2" />              
            </Line>
        </Lines>
    </Data>
</DataSet>

This xml should be serialized into a class which could look like this.

   /* 

    */
using System;
using System.Xml.Serialization;
using System.Collections.Generic;
namespace Xml2CSharp
{
    [XmlRoot(ElementName="Definition")]
    public class Definition {
        [XmlElement(ElementName="Interface")]
        public string Interface { get; set; }
        [XmlElement(ElementName="Context")]
        public string Context { get; set; }
        [XmlElement(ElementName="ContextAction")]
        public string ContextAction { get; set; }
    }

    [XmlRoot(ElementName="Action")]
    public class Action {
        [XmlAttribute(AttributeName="name")]
        public string Name { get; set; }
        [XmlAttribute(AttributeName="context")]
        public string Context { get; set; }
        [XmlAttribute(AttributeName="contextaction")]
        public string Contextaction { get; set; }
    }

    [XmlRoot(ElementName="Actions")]
    public class Actions {
        [XmlElement(ElementName="Action")]
        public List<Action> Action { get; set; }
    }

    [XmlRoot(ElementName="field")]
    public class Field {
        [XmlAttribute(AttributeName="name")]
        public string Name { get; set; }
        [XmlAttribute(AttributeName="value")]
        public string Value { get; set; }
        [XmlAttribute(AttributeName="editable")]
        public string Editable { get; set; }
        [XmlAttribute(AttributeName="LookUpContext")]
        public string LookUpContext { get; set; }
        [XmlAttribute(AttributeName="LookUpAction")]
        public string LookUpAction { get; set; }
    }

    [XmlRoot(ElementName="Fields")]
    public class Fields {
        [XmlElement(ElementName="field")]
        public List<Field> Field { get; set; }
    }

    [XmlRoot(ElementName="Header")]
    public class Header {
        [XmlElement(ElementName="Actions")]
        public Actions Actions { get; set; }
        [XmlElement(ElementName="Fields")]
        public Fields Fields { get; set; }
    }

    [XmlRoot(ElementName="Line")]
    public class Line {
        [XmlElement(ElementName="field")]
        public List<Field> Field { get; set; }
    }

    [XmlRoot(ElementName="Lines")]
    public class Lines {
        [XmlElement(ElementName="Actions")]
        public Actions Actions { get; set; }
        [XmlElement(ElementName="Line")]
        public List<Line> Line { get; set; }
    }

    [XmlRoot(ElementName="Data")]
    public class Data {
        [XmlElement(ElementName="Header")]
        public Header Header { get; set; }
        [XmlElement(ElementName="Lines")]
        public Lines Lines { get; set; }
    }

    [XmlRoot(ElementName="DataSet")]
    public class DataSet {
        [XmlElement(ElementName="Definition")]
        public Definition Definition { get; set; }
        [XmlElement(ElementName="Data")]
        public Data Data { get; set; }
    }

}

The output should be similar to attached file.

We do not know any information about the data we receive. It's just text. We are also not aware if the XML structure is fine as it is or if there is modification needed. Can anyone have a look at this example and give us information about. If someone is able to give us a working example would also be great. If there is more information needed feel free to contact me.

i can't target android 8.1

$
0
0

i have installed android api sdk and every api 27 stuff although still can't target android 8.1

How to add button in pushnotification using Aws ios & android

$
0
0

How to add button in pushnotification using Aws ios & android

Viewing all 58056 articles
Browse latest View live


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