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

Using FreshMVVM what is the best approach for navigating to a tabbed page?

$
0
0

I am currently implementing an app with FreshMVVM. I need to support the following workflow and I have yet to come up with a way to do this without stepping outside of FreshMVVM management of viewmodels, etc.:

Standard Page -> StandardPage -> Tabbed Page

The reason for the tabbed page is the design is asking for a workflow like data enter... Do step 1, click next tab, Do step 2, etc.

I have the standard page to standard page navigation working find with out of the box PushPageModel. While I can navigate to the base tabbed page using the same approach, I am unsure on how to navigate to the tabs once I am in there short of programatically configuring the page to show specific children tabs. Of course, if I do this, I lose the ability to just have my viewmodels be included into the push of the new page.

Thoughts?


Listview Grouping - IsGroupingEnabled

$
0
0

My question is simple:

Which steps do i have to do to activate and deactivate the grouping from a listview at runtime? IsGroupingEnabled = false

I have a perfect grouped Listview with its Itemsource bound to an observable collection of a groupviewmodel.

But the moment i decide to deactivate the property 'IsGroupingEnabled', i see a blank list without any functional template.
Every binding seems to be gone and the list presents itself with a list and each item.tostring();

I already found out out that i definatley have to remove the Listview.GroupHeaderTemplate = null
otherwise it still exists.

Interesting fact, if i set IsGroupingEnabled to 'false' before the listview is generated the firsttime the same datatemplate works for me...

Or do i have to use a second listview, beause it will never get rid of the template cache ?

How to make phone vibrate in Xamarin Forms

$
0
0

Anyone know how I can make the phone vibrate in Xamarin Forms?

Invalid number of rows in section

$
0
0

I trying to bind a ListView with an ObservableCollection. It works on both Windows Phone and Android but when running it on iOS I get an exception. The message says:

MonoTouch.Foundation.MonoTouchException: Objective-C exception thrown. Name: NSInternalInconsistencyException Reason: Invalid update: invalid number of rows in section 0. The number of rows contained in an existing section after the update (130) must be equal to the number of rows contained in that section before the update (0), plus or minus the number of rows inserted or deleted from that section (1 inserted, 0 deleted) and plus or minus the number of rows moved into or out of that section (0 moved in, 0 moved out).

 public partial class TransfersView : ContentPage
     {
         public TransfersView(TransfersViewModel model)
         {
             InitializeComponent();

             BindingContext = model;  
         }
     }


  <ListView x:Name="Transfers" ItemsSource="{Binding Transfers}">
     <ListView.ItemTemplate>
       <DataTemplate>
         <TextCell Text="{Binding Player}" />
       </DataTemplate>
     </ListView.ItemTemplate>
   </ListView>

Does anyone has a solution?

How to make Forms.Maps work on UWP in navigation page?

$
0
0

I have this strange problem in UWP. If I instantiate my mainpage which is having map, as navigation page, the map doesn't show up instead black screen is shown. The map works only if mainpage is normal content page then it works. The map is used in xaml.

How to use FlexLayout in a MVVM framework?

$
0
0

I can fill a FlexLayout dynamically with labels from a collection in the code behind like that (labels are wrapped to several rows):

       foreach (WordItem item in _items)
        {
            Label label = new Label
            {
                Text = item.Name,
                Margin = new Thickness(2, 0, 2, 0),
                FontSize = 16,
                TextColor = Color.Black,
                BackgroundColor = Color.AliceBlue
            };

            flex1.Children.Add(label);
        }

But I can't imagine how to do it in a MVVM application (I'm using Prism/DryIoc). What would be the source property for binding dynamically several labels to the FlexLayout?
Every answer is appreciated!
Marc

Binding Listview to BindingContext and static viewmodel

$
0
0

I have a scenario where I want to bind a page to its own ViewModel but also have a control in the view that binds to a static class on the previous view.

I have the first page that is in the namespace View.MainDetailsPage and within that I have declared:
public static ViewModel.MainDetailsVM _vm;

The user navigates to a modal that shows them a list of pictures they have taken along with the ability to add more. The BindingContext of this modal is a PicturesVM that contains all the actions to be able to take a photo and what to do when saving it. On this page however I would like the ListView of pictures to bind to the ViewModel.MainDetails._vm.Photos observable collection.

I have added the namespace:
xmlns:local="clr-namespace:MyApp.View;assembley=MyApp

Then in the XAML I have
<ListView ItemsSource="{Binding _vm.Photos Source={x:Static local:MainDetailsPage}}" >

But it keeps throwing an error saying it can't find the resource. I've tried a few other permutations with no joy. Please could somebody advise where I am going wrong?

Thanks!
Richard

Calling phone and sending email (IOS, Android and UWP)

$
0
0

Hi all,

Currently, I am using following code for calling and email features, but it is only working in Android and not working in IOS. Also, I need these features in UWP.

For call:

string phoneno = "1234567890";
Device.OpenUri(new Uri("tel:" + phoneno));

For mail:

string email = "sreejithsree139@gmail.com";
Device.OpenUri(new Uri("mailto:" + email ));

Any package available for this?

Thanks in advance


How to add third party SDK to xamarin.forms

$
0
0

Hello everybody!
I need to create a cross-platform mobile app that will use a third party SDK library.
For Android and iOS projects there is a special template like Bindings Library. But I don't see any Bindings Library template in Multiplatform.
Do you have any idea how to bypass that?

Thank you in advance for your time and efforts to help me!

P.S. I use Visual Studio 7.4.3.10.

ERROR WITH LATEST NUGET v2.5.0.77 "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded

$
0
0

I just got latest stable 2.5.0.77107 and I can't compile anymore

[myUser]\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.targets(55,3): error MSB4062: The "Xamarin.Forms.Build.Tasks.GetTasksAbi" task could not be loaded from the assembly [myUser]\.nuget\packages\xamarin.forms\2.5.0.77107\build\netstandard1.0\Xamarin.Forms.Build.Tasks.dll.  Confirm that the <UsingTask> declaration is correct, that the assembly and all its dependencies are available, and that the task contains a public class that implements Microsoft.Build.Framework.ITask.

I replaced my user path with [myUser]

it looks like this bug exists since October in the pre-release:

https://bugzilla.xamarin.com/show_bug.cgi?id=60293

How to add checkbox,radiobutton in xaml file?

$
0
0

Hello all,
I am trying to add checkbox and radiobutton in xaml file by adding XLabs.Platform. It showing me error that "package XLabs.Platform 2.0.5782 was restored using .NET framework version=v4.6.1 instead of project target framework .NET standard version =v2.0 this package may fully compatible with your project".

What i need to do?. Please help me. I need checkbox and radiobutton.

Questions on periodic background tasks for Android and iOS

$
0
0

Hi all,

I am planning to start my first Xamarin.Forms project soon. I have been working with UWP for a long time, and the background tasks are pretty awesome.

To me, it's not entirely clear if the following use case would be achievable:

  • Run a background task (meaning that the app is NOT open) every ~15 minutes.
  • Fetch data from a remote server (small JSON file).
  • Some logic that will check the data and show a notification to the user in some cases.
  • Ideally also update the content of the app's widget.

I saw some documentation for Xamarin.Android related to Services, but for iOS it's unclear if this would be achievable.

Can someone point me to the correct documentation, or if the above scenario is possible for both iOS and Android?

Kind regards,
Niels

Kindly Help: Error: AnalyticsListenerImplementor is not abstract and does not override abstract meth

$
0
0

Hi,

My app started throwing this error in my PCL's Android applocation

Error: error: AnalyticsListenerImplementor is not abstract and does not override abstract method onRenderedFirstFrame(EventTime,Surface) in AnalyticsListener
public class AnalyticsListenerImplementor

What could be the reason for this please?

Thanks,
Jassim

local Calender using xamarin.forms

$
0
0

How to am create event to device local Calender using xamarin.forms, plz help to me!!!!!!

Xamarin forms and prism and IEventAggregator instance from model class

$
0
0

How do i get access to the IEventAggregator from a class?

using AssetofThings.Events;
using Prism.Events;
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Timers;

namespace AssetofThings.Models
{

public class DeviceInfo : INotifyPropertyChanged
{
    IEventAggregator ea;
    public DeviceInfo()
    {
        App.Current.

        ea = Container.Resolve<IEventAggregator>();//******   ERROR..doesnt work
        aTimer.Elapsed += new ElapsedEventHandler(OnTimedEvent);
        DeviceInfo.Current.aTimer.Interval = 5000;
        DeviceInfo.Current.aTimer.Enabled = true;

    }

    private void OnTimedEvent(object sender, ElapsedEventArgs e)
    {

        ea.GetEvent<RequestGeoUpdateEvent>().Publish("RequestGeoUpdateEvent");//*******WANT TO publish an event

    }

    // Singleton
    public static DeviceInfo Current = new DeviceInfo();

   public System.Timers.Timer aTimer = new System.Timers.Timer();


    private int _updateseconds=60;
    public int updateseconds //seconds
    {
        get
        {

            return _updateseconds;
        }
        set
        {
            if (value != updateseconds)
            {
                _updateseconds = value;
                OnPropertyChanged("updateseconds");
            }
        }
    }

    public event PropertyChangedEventHandler PropertyChanged;

    protected virtual void OnPropertyChanged(string propertyName)
    {
        if (PropertyChanged == null)
            return;

        PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
    }
}

}


UWP Editor Alignment Issue

$
0
0

In UWP. The expected behavior is that upon setting the Editor text it is display aligned to the top, but no matter what I have tried is always aligned to the bottom. Yes, I have looked into every single forum and have not found anything closer to a solution. Alternatively is there any UI Library that provides one with this expected behavior I will like also to know about since I have not found any that offers an editor (again for UWP).

Can you help?

Ed.

BottomBar dll

$
0
0

I have integrated Bottom bar dll to shared code. I couldn't change bottom bar icons color or import to color icons. that icons are showing selected is a white color & not selected is a gray color.
anyone tell me how to change the icons color.

Firebase Cloud Messaging not working on Release mode (FCM)

$
0
0

I'm using the FCM for push notifications. Its perfectly working in Debug mode but not working in Release after I signed with KeyStore.

NavigationPage without menu

$
0
0

Hi,

Could you suggest me why this code produces a page with menu?

public App()
{
var mainPage = new NavigationPage(new NotesListPage());
NavigationPage.SetHasNavigationBar(mainPage, false);
MainPage = mainPage;
}

Thank you in advance

The name 'InitializeComponent' does not exist in the current context

$
0
0

I Created a brand new Xamarin.forms project with Visual studio 2017, when i try to compile after creating the project, i'm getting the below error, I didn't change single line of code.

"Error CS0103 The name 'InitializeComponent' does not exist in the current context App2.iOS D:\App2\App2\App2\App.xaml.cs 14 Active"

other info : It is successfully connected to a Mac machine

Viewing all 91519 articles
Browse latest View live


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