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

How to solve ? Exception is: XamlParseException - Cannot assign property "CachingStrategy": Property

$
0
0

Code snippet given below

<ListView.CachingStrategy>

   <OnPlatform x:TypeArguments="ListViewCachingStrategy" Android="RecycleElement" />

</ListView.CachingStrategy>


how to use Sqlite in Shared project

$
0
0

hey
as i mentioned in the title
how to use Sqlite in Shared project
all what i have found is tutorials for PCL projects only
please help

Hide drawer icon in master detail page

$
0
0

I have a master detail page an in certain scenario I want to hide the drawer icon. I know that I can disable it by setting IsGestureEnabled to false but how can I hide it? I guess I need to implement a custom renderer but I am not sure how to hide the icon in the renderer.

Remove separator beneath ListView GroupHeaderTemplate?

$
0
0

Is there any way to remove the separator beneath the ListView group headers?

image

I'm not doing anything special in the DataTemplate.

  <ListView.GroupHeaderTemplate>
    <DataTemplate>
      <ViewCell
        Height="45">
        <StackLayout
          BackgroundColor="White"
          VerticalOptions="FillAndExpand"
          HorizontalOptions="FillAndExpand">
          <StackLayout
            VerticalOptions="CenterAndExpand"
            Margin="15, 0, 5, 0">
            <Label
              Text="{Binding LongName}" />
          </StackLayout>
        </StackLayout>
      </ViewCell>
    </DataTemplate>
  </ListView.GroupHeaderTemplate>

custom callout to TK.CustomMap

Binding button command parameter inside DataTemplate

$
0
0

Hello all,

I found a lot of example in XAML but can't figure out how to manage it in pure c# : Like here => https://forums.xamarin.com/discussion/47751/binding-to-call-a-method-of-the-binding-class-from-a-button

What I want to translate is this sentence of @LoriLalonde

7) Bind the Button's Command property to the StartTimerCommand in your ViewModel. Make sure to set its Command Source to the BindingContext used by the ListView which will point to the ViewModel. > And bind the Button's CommandParameter to the current list item's Timer object:

I want to pass as commandParameter my customObject that is used as DataContext for the datatemplate or at least one of it's property (the ID).
I got a listView for which the itemSource is a customObject.
I got a dataTemplate in which I got a button and some others controls bound to properties, something like that :

var dateResponse = new MR.Gestures.Label();
                dateResponse.SetBinding(Label.TextProperty, "RespondedDate",
                    converter: new ScheduleResponseConverter());

     acceptScheduleButton.SetBinding(MR.Gestures.Button.TappedCommandProperty, "ToLastStepTradeCommand");
                acceptScheduleButton.TappedCommandParameter = ??;
                acceptScheduleButton.BindingContext = _thirdStepTradeViewModel;

How can I pass as commandParameter the DataContext of the dataTemplate ? Someting like in XAML => {Binding}

Thanks

I'm looking for a simple notification... (Bootstrap Notify equivalent..)

$
0
0

hello
I'm looking for a simple notification... (Bootstrap Notify equivalent..)

after clicks.. I would like to notify the status: "for rose has been deleted" for example ..

the notification have to come with no buttons and disappear after 2 seconds and show in the bottom of the screen for example

something like this.. bootstrap-notify.remabledesigns.com/

Identity Providers with Xamarin Forms and Azure

$
0
0

Hi guys,

I'm a bit confused about Identity Providers in a project I'm doing with Xamarin Forms.

I configured Facebook as an IP with Azure Mobile Apps following this page
https://docs.microsoft.com/en-us/azure/app-service-mobile/app-service-mobile-how-to-configure-facebook-authentication

It works, but my doubt is, how can I use the MobileServiceUser result of the authentication process to, for example, post to Facebook or get personal information from Facebook. Is this possible?

Thanks, I'm new in Xamarin and all this mobile world.


Adding condition with Binding

$
0
0

Hi Guys,
I have two images like following, both are inside a viewcell.

                           <Image
                                    Source="like.png"
                                    IsVisible="{Binding userLiked}">
                            </Image>
                            <Image
                                    Source="liked.png"
                                    IsVisible="{Binding userLiked}">
                             </Image>

If the {Binding userLiked} value is true i want to show the second image(liked.png) and if false show the first image(like.png). Second image is working fine for true value. But i don't know how to check the false value. I am declaring userLiked as a string.

Can you help me.
Thanks in advance.

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

$
0
0

After deserializing the data json , the above exception is thowing
How do I rectify this error

MVVM Question when involving lists

$
0
0

Hello,

Question isn't realistically related to Xamarin Forms, but I am developing in Xamarin Forms. My question is more related to MVVM design principals, and there is something I can't quite understand properly - so wondering if I could get an answer from someone with more experience.

Take the following example where I am maintaining a list of Teams;

Is it best practice to do the following;

  • Create a model for Team, implementing the properties of Team
  • Create a ViewModel for Team, implementing Application logic for Team (e.g API access, datastore logic, and manipulation of fields)
  • Create a ViewModel for Teams - containing an ObservableCollection of TeamViewModel

Is this something to be avoided? E.g nesting ViewModels? Or is this "best practice". I can see the value to doing this but i don't know if its bad practice/or any negatives.

Or should I;

  • Create a model for Team
  • Create a ViewModel for Teams, containing an ObservableCollection of Team Model?

And yes, the result will be a View, which will have a BindingContext to one of the ObservableCollections.

Thanks for the help - I understand this might be basic to most people - and maybe i'm reading too much in to it.

Setting Title on Xaml ContentPage not working

$
0
0

I've created a very simple Xaml ContentPage and got an MVVM scenario working all fine, but when I set the Title on the Main ContentPage element it isn't showing any title at all, its just shows the ContentPage content - am I missing something?

Content Page:

<?xml version="1.0" encoding="utf-8" ?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
                   xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
                   x:Class="MyApp.View.HomeView"
        xmlns:viewModel="clr-namespace:MyApp.ViewModel;assembly=MyApp"
        Title="Testing">

    <ContentPage.BindingContext>
        <viewModel:HomeViewModel />
    </ContentPage.BindingContext>

    <Label Text="{Binding Message}"
            VerticalOptions="Center"
            HorizontalOptions="Center">
    </Label>

</ContentPage>

I'm debugging on Android using both Genymotion and a device (Galaxy S4 + Nexus 5) and I'm just ot seeing any action bar at all.

Thanks

Matt

Push Notification with badge

$
0
0

I did a test this way in MainActivity

Badge badge = new Badge(this);
Contador++;
badge.count(Contador);

That test is working but is a test. Now i need to increment the badge when the App receive message(PN). This example is in the MainActivity, but all class for receive message in my App are in PCL project(App.xaml.cs). How can i do to increment the badge. And when i launch my App the badge will be reset, if i do Contador = 0 the badge is reset.

Xamarin Forms iOS app crashes with FileNotFoundException; Android app works fine.

$
0
0

I have a Xamarin Forms app which runs perfectly fine under Android on both the emulator or my physical device. However, when I try and run the iOS project, it fails on startup when its setting up the SQLLite connection/configuration.
Its throwing a FileNotFoundException complaining about System.ComponentModel.DataAnnotations.

This is referenced in the portable class project (and set Copy Local to true) and the model class that has the Data annotations works fine on Android. Indeed, if i look in

<my app path>\<myapp>.iOS\bin\iPhoneSimulator\Debug

I can see System.ComponentModel.DataAnnotations.dll in there. But for some reason the app is crashing:

        Unhandled Exception:
        System.AggregateException: One or more errors occurred. ---> System.IO.FileNotFoundException: Could not load file or assembly 'System.ComponentModel.DataAnnotations, Version=4.0.0.0, Culture=neutral, PublicKeyToken=31bf3856ad364e35' or one of its dependencies.
          at (wrapper managed-to-native) System.MonoCustomAttrs:GetCustomAttributesDataInternal (System.Reflection.ICustomAttributeProvider)
          at System.MonoCustomAttrs.GetCustomAttributesData (System.Reflection.ICustomAttributeProvider obj) [0x0000e] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System/MonoCustomAttrs.cs:303
          at System.Reflection.CustomAttributeData.GetCustomAttributes (System.Reflection.MemberInfo target) [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System.Reflection/CustomAttributeData.cs:119
          at System.Reflection.MonoProperty.GetCustomAttributesData () [0
        x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/corlib/System.Reflection/MonoProperty.cs:463
          at System.Reflection.MemberInfo.get_CustomAttributes () [0x00000] in /Library/Frameworks/Xamarin.iOS.framework/Versions/10.11.0.126/src/mono/mcs/class/referencesource/mscorlib/system/reflection/memberinfo.cs:51
          at SQLite.TableMapping..ctor (System.Type type, SQLite.CreateFlags createFlags) [0x00100] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at SQLite.SQLiteConnection.GetMapping (System.Type type, SQLite.CreateFlags createFlags) [0x00028] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at SQLite.SQLiteConnection.CreateTable (System.Type ty, SQLite.CreateFlags createFlags) [0x00028] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at SQLite.SQLiteAsyncConnection+<>c__DisplayClass11_0.<CreateTablesAsync>b__0 () [0x0002b] in <9b4aaa86123841b8bec74a2ddde70f09>:0
          at System.Threading.Tasks.Task`1[TResult].InnerInvoke () [0x0000f] in /Library/Frameworks/Xamarin.iOS.framework/Version

Has anyone seen this behaviour before or have any idea how I can diagnose it?

Thanks

Integrate Facebook login in Xamarin.Forms PCl

$
0
0

I want to Integrate Facebook login in my Project that is using Xamarin.Forms PCl.

is it possible to integrate Facbook login in xamarin.form for Windows 8 App and others platform too?


Google Places Api in Xamarin.Forms Application

$
0
0

I start whit a cross-platform project where i need to use Google Places Api and other but unfortunately i don't find a library for use in Xamarin.Forms. By the way i can use web service api for get json and create my objects, now i think to create a very small library for Xamarin.Forms and i have few questions:

  • I can create objects based on json and web service api of Google Places but i don't know if this is a good idea, now i use **json2csharp **for map the json and create class but if google change a name of variable or add other my creation object failed. This is a good practice?
  • In terms of performance is good to use web service for create objects and use in xamarin.forms project?
  • This is a good idea for create a library which does not exist? I don't know the structure of this type of library

Drawer Layout Exist both in Xamarin.Android.Support.Core.UI and Xamarin.Android.Support.V4

$
0
0

I am a newbie in Xamarin with Visual Studio 2015. I have created project with Android Support V4 and V7 earlier, and it's work fine. But after i add components from Google Play Service MAP, then all my V4 objects get errors. For instance my drawer layout, this is the error :

Severity Code Description Project File Line Suppression State Error CS0433 The type 'DrawerLayout' exists in both 'Xamarin.Android.Support.Core.UI, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' and 'Xamarin.Android.Support.v4, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null' gtSMobileAndroid D:\Source_eMedWeb\gotoSehat\gtSMobileAndroid\gtSMobileAndroid\MainActivity.cs 20 Active

I have done many things to recover, deleting all packages and reinstall the components, but still i get this error.

Please advice.............thank you very much in advance.......

Error inflating class android.support.v7.widget.Toolbar after updaring to v7.AppCompat Version 23.3

$
0
0

I am creating a Xamarin Forms Project and using android.support.v7.widget.Toolbar with FormsAppCompatActivity. The code I'm posting below was working with Xamarin.Android.Support.v7.AppCompat Version: 23.0.1.3

But after I upgraded to 23.3.0 this has started throwing Android.Views.InflateException: Binary XML file line #1: Error inflating class android.support.v7.widget.toolbar exception.

Here is my code for MainActivity

[Activity(Label = "AppMob.Client", Icon = "@drawable/icon", MainLauncher = true, ConfigurationChanges = ConfigChanges.ScreenSize | ConfigChanges.Orientation)]
    public class MainActivity : global::Xamarin.Forms.Platform.Android.FormsAppCompatActivity
    {

        protected override void OnCreate(Bundle bundle)
        {
            FormsAppCompatActivity.ToolbarResource = Resource.Layout.toolbar;
            FormsAppCompatActivity.TabLayoutResource = Resource.Layout.tabs;

            base.OnCreate(bundle);

            global::Xamarin.Forms.Forms.Init(this, bundle);

            Xamarin.FormsMaps.Init(this,bundle);
            GoogleAnalyticsHelper.GetGASInstance().Initialize_NativeGAS(Application.Context);  //For GA initialization
            LoadApplication(new App());
        }
}

This is my code for Resource.Layout.toolbar

    <?xml version="1.0" encoding="utf-8"?>
    <android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
        xmlns:app="http://schemas.android.com/apk/res-auto"
        android:id="@+id/toolbar"
        android:layout_width="match_parent"
        android:layout_height="?attr/actionBarSize"
        android:minHeight="?attr/actionBarSize"
        android:background="?attr/colorPrimary"
        android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
        app:popupTheme="@style/ThemeOverlay.AppCompat.Light"
        app:layout_scrollFlags="scroll|enterAlways" />

How to change the name of app(In the screen, under the icon)

$
0
0

Hi guys,

I am building an app in Xamarin.Forms. I want to change the name of app, both iOS and Android. I tried to change the information in mainactivity.cs and Androidmanifest. However it is not working. I also don't know how to do it in iOS.

Would you please to help me?

Thank you very much.

Slider control as audio seekbar

$
0
0

Hi,
I'm writing a simple media player using Dependency services to play an mp3 file. While the sound is playing it updates a "slider" in the main forms window. everything works fine so far, now I just want the slider to pause the mp3 and then jump to the position that relates to where the user drags the slider, just like a normal seekbar but I can't find any information on how to pickup events from when the user interacts with the slider other then the "value changed event" that will be raised all the time since the code change this value from the player on each platform. Does someone know how tho get events from this user interaction with the slider?

Best Regards
/magnus

Viewing all 77050 articles
Browse latest View live


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