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

Strange System.InvalidCastException: Specified cast is not valid

$
0
0

Hi, I'm running into this Specified cast is not valid issue when I do a SelectedIndexChanged event in my pickers, it happens at random times, the weird part is that the stacktrace doesn't show any reference to any line in my code but the main.cs, so I think this might be a Xamarin Forms bug, has anyone run into something similar?

Thank you.

I'm using Xamarin Forms 2.5.0.121934 in VS form Mac 7.3.2 (build 12)

System.InvalidCastException: Specified cast is not valid. at (wrapper castclass) System.Object:__castclass_with_cache (object,intptr,intptr) at Xamarin.Forms.Platform.iOS.VisualElementRenderer``1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.RendererPool.UpdateRenderers (Xamarin.Forms.Element newElement) [0x0008c] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.RendererPool.UpdateNewElement (Xamarin.Forms.VisualElement newElement) [0x00080] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.VisualElementPackager.SetElement (Xamarin.Forms.VisualElement oldElement, Xamarin.Forms.VisualElement newElement) [0x00050] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.VisualElementPackager.OnRendererElementChanged (System.Object sender, Xamarin.Forms.Platform.iOS.VisualElementChangedEventArgs args) [0x0001c] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer``1[TElement].OnElementChanged (Xamarin.Forms.Platform.iOS.ElementChangedEventArgs``1[TElement] e) [0x0002c] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer``1[TElement].SetElement (TElement element) [0x00118] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.VisualElementRenderer``1[TElement].Xamarin.Forms.Platform.iOS.IVisualElementRenderer.SetElement (Xamarin.Forms.VisualElement element) [0x00000] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.UpdateCell (Xamarin.Forms.ViewCell cell) [0x000e5] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.ViewCellRenderer+ViewTableCell.set_ViewCell (Xamarin.Forms.ViewCell value) [0x0000a] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.ViewCellRenderer.GetCell (Xamarin.Forms.Cell item, UIKit.UITableViewCell reusableCell, UIKit.UITableView tv) [0x0004d] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.CellTableViewCell.GetNativeCell (UIKit.UITableView tableView, Xamarin.Forms.Cell cell, System.Boolean recycleCells, System.String templateId) [0x00080] in <f321195339234cc7a2f7f1d5fa08167d>:0 at Xamarin.Forms.Platform.iOS.TableViewModelRenderer.GetCell (UIKit.UITableView tableView, Foundation.NSIndexPath indexPath) [0x0001d] in <f321195339234cc7a2f7f1d5fa08167d>:0 at (wrapper managed-to-native) UIKit.UIApplication:UIApplicationMain (int,string[],intptr,intptr) at UIKit.UIApplication.Main (System.String[] args, System.IntPtr principal, System.IntPtr delegate) [0x00005] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/src/UIKit/UIApplication.cs:79 at UIKit.UIApplication.Main (System.String[] args, System.String principalClassName, System.String delegateClassName) [0x00038] in /Users/builder/data/lanes/5665/6857dfcc/source/xamarin-macios/src/UIKit/UIApplication.cs:63 at SuperSeedsMobile.iOS.Application.Main (System.String[] args) [0x00002] in /Users/alan/Dev/Projects/SuperSeedsMobile/iOS/Main.cs:19 }


ToolbarItems is not visible, only GoBack arrow visible

$
0
0

In debug mode, i can see my both toolbaritems in code behind, but non are visible in contentpage, only GoBack arrow is visible.
see in attachments!

I want to display submenu items when clicking on MenuItems in MasterDetailPage

$
0
0

I want to display submenu items when clicking on MenuItems in MasterDetailPage

what is best way store logged in use detail and access it whenever we need

$
0
0

i am creating android,Ios and uwp cross application.i am looking for best way to store logged in user detail store in device.i am looking for best practice solution.please any one help me out of this stuff.

also i want to learn create custom rendered for android, Ios and Uwp. please suggest me good article.

Is there a way to reference (x:reference?) an element thats in a datatemplate?

$
0
0

I want to animate an element inside the headertempalte (datatemplate) of a listview, and for that, i need to reference (x:reference?!) that element. Is that possible? I couldnt find a way..

keyboard= Numeric not working in IOS 11.2.1?

$
0
0

This was working before, not sure if i should update xamarin forms but now, in android the numeric keyboard is working fine, but when i emulate in IOS, i get the standard keyboard(instead the numeric), anybody know why is not working? should i need to update xamarin forms?

<Entry Keyboard="Numeric" />

Entry not accepting "," on numeric keyboard

$
0
0

Entry won't accept using "," as decimal separator when using Numeric keyboard. This is broken on Xamarin.Forms versions 2.4 and 2.5. Latest working version is 2.3.
However the "." is working fine but not every device has the "." character available at all on numeric keyboard (e.g. Samsung Galaxy S8) unless you change the device locale to "en-US".

How to add Service reference to a NETStandard project?


Overlay on carousel page

$
0
0

Hey. I am trying to build on boarding for my app, in the same style as the one from Slack (google "app onboarding", I am not allowed to post links). I am using a carousel page, and I would like to add overlaying elements to the view in order to create a logo, a skip button and progress "dots" that show how far the user is in the process. Does anyone have a good idea as to how this can be accomplished? Should I use something else than a carousel page?

Thanks in advance, hope you have a great day

Bind the ItemsSource property of a ListView in a custom control

$
0
0

Hi everybody,

I'm trying to bind the ItemSource property of a ListView that it's located in a ContentView.

Here is the XAML code of the ContentView:

<ContentView  xmlns="http://xamarin.com/schemas/2014/forms"
              xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
              x:Class="App.Controls.CustomListView">

  <ListView ItemsSource="{Binding ItemsSource}"/>
</ContentView>

The code behind of this control:

namespace App.Controls
{
    public partial class CustomListView : ContentView
    {
        public CustomListView()
        {
            InitializeComponent();
        }

        /// <summary>
        /// Identifies the ItemsSource attached property.
        /// </summary>
        public static readonly BindableProperty ItemsSourceProperty = BindableProperty.Create("ItemsSource", typeof(IEnumerable), typeof(CustomListView));

        /// <summary>
        /// Accessors
        /// </summary>
        public IEnumerable ItemsSource
        {
            get { return (IEnumerable)GetValue(ItemsSourceProperty); }
            set
            {
                SetValue(ItemsSourceProperty, value);
            }
        }
    }
}

Then I bind an ObservableCollection on this control like that:

<ctrl:CustomListView ItemsSource="{Binding List}" />

When the bound list is feeded, the ListView is not updated, does anyone have an idea of where the problem is located?

Thanks for your help!

Hello, Xamarin.Forms Multiscreen Issue

$
0
0

I am trying to work through this tutorial:

https://developer.xamarin.com/guides/xamarin-forms/getting-started/hello-xamarin-forms-multiscreen/quickstart/

When I try to build, I get the following error:

Position 14:19. No property, bindable property, or event found for 'ItemsSource', or mismatching type between value and property.
in CallHistoryPage.xaml

I have double checked and all my code matches the example. The first part of the tutorial (Hello, Xamarin.Forms) worked fine. Can anyone help about what may be going on?

In passing, this is a stunningly unhelpful error message. First it combines two quite different errors forcing you to investigate both. Second it says two types mismatch but fails to say what the types are!

Also these tutorials need to be updated to VS2017, in particularly the "new"dialogs are not exactly as shown.

Not a good first impression guys!

Error getting while implementing tap guest recognizer for custom control

How to add a button on NavBar with transparent background in Xamarin Forms?

$
0
0

How to add a button on Navigation Bar with transparent background in Xamarin forms.
Here is the sample image-

how to create this?

Hide Editor underline

$
0
0

Hi,

I am using an editor in my UI. But the black underline is irritating, is there any way to remove that underline?

Thanks in advance :)

back button issue with push notification

$
0
0

Hi, my project is in Mvvm architecture. i am facing back button issue with push notification.( please help me thank in Advance )
project flow,
Homepage->Latestnewspage->LatestnewsDetailpage.
problem,

                              (refreshing here)

LatestnewsDetailpage<-Homepage<-Latestnewspage<-LatestnewsDetailpage.

here is my method

    public async Task LoadNotificationData()
    {
        if (Session.Instance.SelectedNews != null)--->when i am passing that SelectedNews==null back button problem is solved 
                                                                                             But, pus notification not going to  LatestNewsDetailViewModel page it is going to Homepage
        {
            Navigation.Push(ViewFactory.CreatePage<LatestNewsDetailViewModel>());
        }
        else if (Session.Instance.SelectedECircular != null)
        {
            Navigation.Push(ViewFactory.CreatePage<ECirularsDetailViewModel>());
        }
        else if (Session.Instance.SelectedHomeWork != null)
        {
            Navigation.Push(ViewFactory.CreatePage<HomeWorkViewModel>());
        }
        else if (Session.Instance.SelectedAttendance != null)
        {
            Navigation.Push(ViewFactory.CreatePage<AttendanceViewModel>());
        }
        else if (Session.Instance.SelectedPhoto != null)
        {
            Navigation.Push(ViewFactory.CreatePage<PhotoGalleryViewModel>());
        }
        else if (Session.Instance.SelectedEvent != null)
        {
            Navigation.Push(ViewFactory.CreatePage<EventsAndCalendarViewModel>());
        }
        else if (Session.Instance.SelectedVideo != null)
        {
            Navigation.Push(ViewFactory.CreatePage<VideoGalleryViewModel>());
        }
        else if (Session.Instance.SelectedFeedback != null)
        {
            Session.Instance.FeedbackList = Session.Instance.SelectedFeedback;
            Navigation.Push(ViewFactory.CreatePage<SubjectWiseFeedbackViewModel>());
        }

        //if (MenuList == null || MenuList.Count == 0)
        await LoadMenuData();
        await LoadInstituteAndUserData();

        Task.Run(() =>
        {
            CheckFcmAndRegister();
        });

        //StringExtensions.sendEmail("FCM Token", Session.Instance.DeviceFCMToken);
    } 

I want to Compress the image, which i am getting from signature pad.

$
0
0

The scenario is i need to convert the image to base64string, and i need to send to server that base64string. In smaller devices its working fine when coming to iPhone 6s devices its showing the data is too large, for that i need to compress the image without losing data.

Thannks,
Subbu.P

Convert Image to Byte Array and Convert Byte Array to Image in Xamarin.Forms

$
0
0

May I ask about How to "Convert Image to Byte Array" and "Convert Byte Array to Image" in Xamarin.Forms?
But i'm facing problem to convert MediaFile into Byte[].
I'm using Xam.Plugin.Media ( http://www.nuget.org/packages/Xam.Plugin.Media ) to access camera and gallery.
Please kindly guide me how to convert MedieFile into Byte[].
Thank you.
Any sample source code for references?

Prism Navigation

$
0
0

I would like to remove the Login page after navigation. I am using PRISM. It doesn't matter just login page. It could be any page. I couldn't find ant way to do that.

Please help me on it. Thanks in advance.

Set the Height of the Entry when inside the frame ?

$
0
0

When i am trying to add the entry inside the frame,The letter which i am typing become Hiding ..(Top and Bottom Portion) So i need to increase the height of the Entry ??

Please help me

clear all the pins in map

$
0
0

in xamarin forms map application i user this code to clear all pin in map
customMap.CustomPins.clear();
customMap.Pins.clear();
it work in ios but in android it doesn't work??
So how i can delete all pin in maps befor add new??

Viewing all 58056 articles
Browse latest View live


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