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

How to get OS version of mobile from C# in Xamarin Forms ?

$
0
0

Hi, I am using Xamarin forms for iOS and Android app development, I want to add the few values to insight related to mobile information. How to find the mobile platform and Mobile OS from C# code ?


Error: Member 'System.DateTime' is declared in another module and needs to be imported

$
0
0

I'm not sure how to correct this error. (I've searched Xamarin Forums and Google without finding anything on this.)

Following the Xamarin Guide for DatePicker, I added a DatePicker to my page:

<DatePicker VerticalOptions="Center" HorizontalOptions="FillAndExpand" Grid.Row="2" Grid.Column="1" >
    <DatePicker.Format>yyyy-mm-dd</DatePicker.Format>
    <DatePicker.MinimumDate>
        <sys:DateTime x:FactoryMethod="Parse" >
            <x:Arguments>
                <x:String>Jan 1 2016</x:String>
            </x:Arguments>
        </sys:DateTime>
    </DatePicker.MinimumDate>
</DatePicker>

And I included the specified namespace:

<ContentPage xmlns="http://xamarin.com/schemas/2014/forms"
        xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
        xmlns:sys="clr-namespace:System;assembly=mscorlib"
        x:Class="...">

But I get the error Error: Member 'System.DateTime' is declared in another module and needs to be imported shown in the title whenever I build.

Entry ReadOnly?

$
0
0

Does anyone know how to simulate a ReadOnly property for the Entry control since it doesn't exist? I'm hoping that there is an easier way than writing a custom render for each platform.

Thanks,
Steve

Xamarin.Forms 2.3.4.184-pre1

$
0
0

We've pushed Xamarin.Forms 2.3.4.184-pre1 to nuget. To install the pre-release, check the pre-release option in your nuget manager and install this version.

If you’ve got a bug to report, drop us a quick report here so we can troubleshoot in detail.

Important notes

  • Xamarin.Forms 2.3.4 depends on a Xamarin installation of Cycle 8. Users upgrading from Xamarin.Forms 2.3.3 (or earlier) will experience numerous compile errors if they attempt to build without first upgrading their Xamarin installation.

  • When upgrading Xamarin.Forms, take care not to simply "update all" as that will update the Xamarin.Android.Support packages to an incompatible version. More info here.

2.3.4.184-pre1

For all the details, please read the release post here. There is SO much goodness in this release, it's actually too long for the forum.

How to combine NavigationPage and TabbedPage

$
0
0

Hi there

I realise that variations of this have been asked several times, but none seem to really fit my scenario.

I am writing an app that has two logical pages:
1. A page that lists the games a user is playing (GamesListPage)
2. A tabbed page that presents the details of a given game (GameDetailsPage) on a number of tabs (e.g. one tab shows the details, another shows the other players, a 3rd shows a list of messages received, etc)

I know the tabbed page is really a collection of pages itself, and each tab is a separate page, but the UX I'd like to create is:

  • User logs in and is presented with page 1 showing a list of games

  • User taps a game in the list and then navigates to the tabbed page to see more details about it

  • User can tap the back button on the tabbed page to go back to the list of games

So far, I have set the main page of the app to be a NavigationPage containing the GamesListPage. When the user taps an item in the list, I can either use PushAsync() or PushAsyncModal() to navigate to the GameDetailsPage - all OK so far.

My problem is that the iOS UX guidelines say that placing a TabbedPage inside a NavigationPage is bad design, and that tabs should be at the top level of your app. I think my proposed design is perfectly sensible and will make sense to the user, or am I just mistaken and it would be confusing?

If it is sensible, how would you go about building it?

Thanks in advance

Trev

Working with ControlTemplates breaks event to command in ContentPage

$
0
0

I'm working with ControlTemplates as described in this article.

Creating the controlTemplate went without a hitch, as did applying it and even binding to it. The problem is that while most of the binding still works in my ContentPage, the EventToCommand in my ListView has broken (tapping no longer invokes the command).

Have you seen this before? Is this a known problem? Is there a fix?

Thanks!!
jesse

Entry control expands beyond StackLayout container

$
0
0

I'm using the following (test) code to dynamically create a Page Content. I'm expecting the Entry control to stay within the StackLayout bounds and clip its large Text value. Somehow this doesn't work like I want.

What am I doing wrong here?


public MyPage() { InitializeComponent(); var stackMain = new StackLayout() { Orientation = StackOrientation.Vertical, Spacing = 2, BackgroundColor = Color.Yellow }; Content = stackMain; Padding = new Thickness(15, Device.OnPlatform(25, 5, 5), 15, 10); var label = new Label() { Text = "Test:" }; stackMain.Children.Add(label); var stackEntry = new StackLayout() { Orientation = StackOrientation.Horizontal }; stackMain.Children.Add(stackEntry); var entry = new Entry() { Text = "Blaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa", IsEnabled = false, HorizontalOptions = LayoutOptions.FillAndExpand }; stackEntry.Children.Add(entry); var button = new Button() { Text = "Click me" }; stackEntry.Children.Add(button); } ![](https://us.v-cdn.net/5019960/uploads/editor/mi/gnxifpmuvffh.png "") ![](https://us.v-cdn.net/5019960/uploads/editor/29/yuxwh6b3fqu5.png "")

Moved: Signature Pad View does not contain getImage


Relative Size to Font and Images

$
0
0

Hi Friends,

I am using Xamarin Forms. I have to give relative size to Font and Images so that text size and image size render across all devices and resolution. Please do needful with proper code snippet.

Thanks,
Prashant N

Xamarin.Forms - Different renders in Android/iOS

$
0
0

Hello, I am having a problem to have the same render in Android and iOS. I already achieved the render that I want with Android, but I'm failing to do it in iOS.

At the moment this is my current iOS render:

I want it to look like this which is my Android render

This is the xaml code:

      <StackLayout
                Orientation="Vertical"
                AbsoluteLayout.LayoutBounds=" .5, 1.5, .63, .8"
                AbsoluteLayout.LayoutFlags="All"
                Spacing="18"
                >

        <ctrls:ExtendedEntry Placeholder="email" Text="{Binding UserName}"/>

        <ctrls:ExtendedEntry Placeholder="password" Text="{Binding Password}" IsPassword="True"/>
    </StackLayout>

And this is my Element Change control that I am using at the moment:

    protected override void OnElementChanged(ElementChangedEventArgs<Entry> e)
    {
        base.OnElementChanged(e);

        if (Control != null)
        {
            ExtendedEntry element = (Element as ExtendedEntry);
            if (element != null)
            {
                var borderLayer = new CALayer();
                borderLayer.MasksToBounds = true;
                borderLayer.Frame = new CGRect(0f, element.Height, element.Width, 0f);
                borderLayer.BorderColor = UIColor.White.CGColor;
                borderLayer.BorderWidth = 2.0f;
                Control.Layer.AddSublayer(borderLayer);
                Control.BorderStyle = UITextBorderStyle.None;
            }
        }
    }

The problem seems to be in this line:
borderLayer.Frame = new CGRect(0f, element.Height, element.Width, 0f);

since the element.Height and Width are -1.

At the moment I didn't find anyway to get the original element size, I can make the input row bigger or smaller but not accordingly to the original element size. Any suggestions?

Can not convert 'bool' to 'xamarin.forms.bindingbase'

$
0
0

Hello,

I have make a custom calendar by code only and i'm trying to bind a property of my data class with a property of a custom toggleButton created by @NMackay

My method:

    private ToggleButton CreateMagicBox(MagicObject MO)
    {
        ToggleButton TB = new ToggleButton();
        TB.Command = CheckMagicObjectCommand;
        TB.CommandParameter = MO;

        Trigger TriggerTrue = new Trigger(typeof(ToggleButton));
        TriggerTrue.Property = ToggleButton.CheckedProperty;
        TriggerTrue.Value = true;
        TriggerTrue.Setters.Add(new Setter
        {
            Property = ToggleButton.BackgroundColorProperty,
            Value = Color.Aqua
        });

        Trigger TriggerFalse = new Trigger(typeof(ToggleButton));
        TriggerFalse.Property = ToggleButton.CheckedProperty;
        TriggerFalse.Value = false;
        TriggerFalse.Setters.Add(new Setter
        {
            Property = ToggleButton.BackgroundColorProperty,
            Value = Color.White
        });

        TB.Triggers.Add(TriggerTrue);
        TB.Triggers.Add(TriggerFalse);
        // Not works
        //TB.SetBinding(ToggleButton.CheckedProperty, MO.IsSelected);
        // Not works
        return TB;
    }

My class:

        public class MagicObject : BindableBase
        {
            #region // Fields
            private bool _isNotSave;
            private bool _isSelected;
            private int _employeeID;
            private DateTime _DateBegin;
            private DateTime _DateEnd;
            #endregion

            #region // Properties
            public bool IsNotSave { get { return _isNotSave; } set { SetProperty(ref _isNotSave, value); } }
            public bool IsSelected { get { return _isSelected; } set { SetProperty(ref _isSelected, value); } }
            public int EmployeeID { get { return _employeeID; } set { SetProperty(ref _employeeID, value); } }
            public DateTime DateBegin { get { return _DateBegin; } set { SetProperty(ref _DateBegin, value); } }
            public DateTime DateEnd { get { return _DateEnd; } set { SetProperty(ref _DateEnd, value); } }
            #endregion

            public MagicObject(int employeeID, DateTime date, int indexPeriod)
            {
                EmployeeID = employeeID;
                DateBegin = date.Add(App.API.Enterprise.PlanningPeriods[indexPeriod].Begin);
                DateEnd = date.Add(App.API.Enterprise.PlanningPeriods[indexPeriod].End);
                if(App.API.Enterprise.PlanningPeriods[indexPeriod].AddDay) { DateEnd = DateEnd.AddDays(1); }
            }
        }

Best regards.

What is this Warning messge when an app is unistalled using adb?

$
0
0

I uninstalled an app from emulator using the command adb -e uninstall my_package_name. The I got the following warning message. What is it?

WARNING: linker: libdvm.so has text relocations.This is wasting memory and is a security risk. Please fix.

Lots of errors in debugger output. Can anyone help?

$
0
0

My first Xamarin Forms project runs in the Android Emulator (7" KitKat 4.4) but doesn't send the out Writeline output I expected to the debugger.

I get a load of errors in the debugger output.

This is some of it: -

02-01 16:18:19.071 D/Mono ( 1239): AOT module 'mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-mscorlib.dll.so" not found
02-01 16:18:19.071 D/Mono ( 1239): AOT module '/Users/builder/data/lanes/3511/501e63ce/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/mscorlib.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-mscorlib.dll.so" not found
02-01 16:18:19.211 D/Mono ( 1239): AOT module '/storage/emulated/0/Android/data/Contacts1.Droid/files/.override/Contacts1.Droid.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Contacts1.Droid.dll.so" not found
02-01 16:18:19.211 D/Mono ( 1239): AOT module '/Users/builder/data/lanes/3511/501e63ce/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/Contacts1.Droid.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Contacts1.Droid.dll.so" not found
02-01 16:18:19.215 D/Mono ( 1239): AOT module '/storage/emulated/0/Android/data/Contacts1.Droid/files/.override/Contacts1.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Contacts1.dll.so" not found
02-01 16:18:19.219 D/Mono ( 1239): AOT module '/Users/builder/data/lanes/3511/501e63ce/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/Contacts1.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Contacts1.dll.so" not found
02-01 16:18:19.219 D/Mono ( 1239): AOT module '/storage/emulated/0/Android/data/Contacts1.Droid/files/.override/FormsViewGroup.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-FormsViewGroup.dll.so" not found
02-01 16:18:19.219 D/Mono ( 1239): AOT module '/Users/builder/data/lanes/3511/501e63ce/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/FormsViewGroup.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-FormsViewGroup.dll.so" not found
02-01 16:18:19.227 D/Mono ( 1239): AOT module '/storage/emulated/0/Android/data/Contacts1.Droid/files/.override/Xamarin.Android.Support.Design.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Xamarin.Android.Support.Design.dll.so" not found
02-01 16:18:19.227 D/Mono ( 1239): AOT module '/Users/builder/data/lanes/3511/501e63ce/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/Xamarin.Android.Support.Design.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Xamarin.Android.Support.Design.dll.so" not found
02-01 16:18:19.247 D/Mono ( 1239): AOT module '/storage/emulated/0/Android/data/Contacts1.Droid/files/.override/Xamarin.Android.Support.v4.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Xamarin.Android.Support.v4.dll.so" not found
02-01 16:18:19.255 D/Mono ( 1239): AOT module '/storage/emulated/0/Android/data/Contacts1.Droid/files/.override/Xamarin.Android.Support.v7.AppCompat.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Xamarin.Android.Support.v7.AppCompat.dll.so" not found
02-01 16:18:19.255 D/Mono ( 1239): AOT module '/Users/builder/data/lanes/3511/501e63ce/source/monodroid/builds/install/mono-x86/lib/mono/aot-cache/x86/Xamarin.Android.Support.v7.AppCompat.dll.so' not found: dlopen failed: library "/data/app-lib/Contacts1.Droid-1/libaot-Xamarin.Android.Support.v7.AppCompat.dll.so" not found

Anyone got any ideas what's going wrong?

Thanks,
Stephen.

TextToSpeech plugin not working on Android

$
0
0

Hi,

I'm trying to get the TextToSpeech plugin working but when I call CrossTextToSpeech.Current.Speak("Say something"); I'm getting the following error:-
System.NotImplementedException: This functionality is not implemented in the portable version of this assembly. You should reference the Xam.Plugins.TextToSpeech NuGet package from your main application project in order to reference the platform-specific implementation.

I've tried adding the nugget package using both the package manager and the package manager console. It looks like the references are getting added but I'm still getting these problems on my Android device. This works fine in the UWP app.

Any ideas?

Thanks,

Geoff

ListView.Header causes issues on WinPhone

$
0
0

If I have a ListView.Header in my Xaml, then my app ignores the ListView.ItemTemplate when run on WinPhone. If I remove the header, the template is displayed fine. An empty <ListView.Header></ListView.Header> works fine too, but any elements in it breaks the app. The header and template work fine on Android and iOS.


'FFImageLoading.Forms' image is not loading in ios

$
0
0

I have listview with label and image column, for image i used FFImageLoading.Forms.CachedImage. It works fine in the android.

In Ios no image is loading in the list. I have included the CachedImageRenderer.Init(); in AppDelegate.cs.
Can any one tell me I'm missing any thing.

Custom Render Slider

$
0
0

Hello colleagues..

Someone has any idea how to create a bar to the image that I show .. would be much appreciated ...

Any idea, guide, etc .. will be of good help ..

Thanks in advance

Remove all border but bottom on an Entry

$
0
0

Can I have an entry just with bottom border like this image?

I know you can do it with a Custom Renderer, but how? Can someone have a solution?

Cross-platform Speech Recognition Using DependencyService

$
0
0

Ive been trying to implement, at least on the android side, speech recognition using pcl code. The biggest problem Im encountering is the fact that the speech uses onActivityResult to get any data back from the speech activity which I havent been able to do.

Are there any working examples out there that uses a DependencyService to get data back from RecognizerIntent?

AppCompat in styles.xml: No resource found that matches the given name

$
0
0

I just created a Xaml PCL app but can't compile the Android app. I'm having issues with the things defined in styles.xml for AppCompat.

Here's styles.xml:

<?xml version="1.0" encoding="utf-8" ?>
<resources>

  <style name="MainTheme" parent="MainTheme.Base">
  </style>
  <!-- Base theme applied no matter what API -->
  <style name="MainTheme.Base" parent="Theme.AppCompat.Light.DarkActionBar">
    <!--If you are using revision 22.1 please use just windowNoTitle. Without android:-->
    <item name="windowNoTitle">true</item>
    <!--We will be using the toolbar so no need to show ActionBar-->
    <item name="windowActionBar">false</item>
    <!-- Set theme colors from http://www.google.com/design/spec/style/color.html#color-color-palette -->
    <!-- colorPrimary is used for the default action bar background -->
    <item name="colorPrimary">#2196F3</item>
    <!-- colorPrimaryDark is used for the status bar -->
    <item name="colorPrimaryDark">#1976D2</item>
    <!-- colorAccent is used as the default value for colorControlActivated
         which is used to tint widgets -->
    <item name="colorAccent">#FF4081</item>
    <!-- You can also set colorControlNormal, colorControlActivated
         colorControlHighlight and colorSwitchThumbNormal. -->
    <item name="windowActionModeOverlay">true</item>

    <item name="android:datePickerDialogTheme">@style/AppCompatDialogStyle</item>
  </style>

  <style name="AppCompatDialogStyle" parent="Theme.AppCompat.Light.Dialog">
    <item name="colorAccent">#FF4081</item>
  </style>
</resources>

Attached images are Android build config, the errors, and my SDK Manager setup.

I have no clue why I'm getting compile time issues.

Viewing all 89864 articles
Browse latest View live


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