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

Xamarin Forms ListView's ScrollToHeader and ScrollToFooter missing

$
0
0

I want to scroll the listView programmatically to its header and footer element's start & end position. But ListView.ScrollTo method allows to scroll within the itemsource elements. Please anyone help me to achieve it.

Thanks in advance.


How can i set entry field text/value from (Rg.Plugins.Popup) page?

$
0
0

In my project i have use Rg.Plugins.Popup for popup.In the custom popup page one list view available.
But problem is I'm unable to set selected list item name into Entry field parent xaml.cs.

Popuppage: PopupList.Xaml
PopupList.Xaml.cs
to set data MainPage.xaml
MainPage.xaml.cs

MainPage.xaml is parent view
PopupList.Xaml is child view.

Is Random working?

$
0
0

Hello!
I wanted to add to my C# file in Xamarin.Forms this part

Random rnd = new Random(); int Number = rnd.Next(1, 3);

However Visual Studio keeps telling that there is no definition Next in Random, this is the first time I see this issue; Console Apps have the same code and there's no problem with them.
P.S. I use System.Collections.Generic

Text Entry without rounded corners in iOS using Xamarin Forms

$
0
0

How can I make a Text Entry control without rounded corners in Xamarin Forms?
In UWP and Android this already works by default.
In iOS the corners are rounded by default. I would like to prevent that.

Other controls such as Button have a BorderRadius property which allows to control the corners. Why is there no such property for an Entry?

Modal page with dismiss/close button.

$
0
0

Hello,
I would like to open a modal page that have a navigation bar with a "X" (cross) at the top left of the page to close/dismiss the page, like showed in Android documentation about bottom sheets

Do you have any idea how can I achieve that in Xamarin.Forms ?

Thanks !

Binding Context vs ItemsSource for ListView in Xamarin Forms

$
0
0

I am developing a Xamarin forms App, in which I have a class which I instantiate and give the value to the BindingContext. The issue is the listview does not show up with the values.

However, if I use the listview XAML reference name in the code behind and assign the list of the class to listview's ItemsSource property it works.

e.g. This is the C# code

public MainPage()
{
InitializeComponent();

        vm = new MainPageViewModel();            

        listview.ItemsSource = vm.People;                  
    }

public class MainPageViewModel
{
public ObservableCollection People = new ObservableCollection();

    public MainPageViewModel()
    {
        for(int i = 0; i <= 5; i++)
        {
            Person person = new Person();
            person.FirstName = "Sidd " + i.ToString();
            person.LastName = "Mehta" + i.ToString();
            People.Add(person);
        }
    }

}

public class Person
{
public string FirstName { get; set; }
public string LastName { get; set; }
}
This is my XAML:


<ListView.ItemTemplate>



</ListView.ItemTemplate>

The above code shows the list view.

But if I use it with binding context, like the following:

XAML Code:


<ListView.ItemTemplate>



</ListView.ItemTemplate>

and C# code:

public MainPage()
{
InitializeComponent();

        vm = new MainPageViewModel();
        BindingContext = vm;                 
    }

This fails.

Any reason or help for this?. I have installed latest community edition of VS 2017, so everything is latest.

Thanks In Advance.

How to implement document picker in ios?

$
0
0

I need to implement document picker in ios, im using visual studio 2017 and netstandard code strategy.
I'm using plugins and not works, always returns error "this functionality is not implemented ...." and
others dont do anything.
I've had too time in this and I have not found a response.
Im have the AppId, and the provisioning profile with the capabilities with Cloudkit, im have the configurations and the Entitlements.plist, Im have one interface to try to implement this, but in this part is on the i'm are in trouble, im never programming in objective c. Im have the archives in icloud in the iphone, i need to can select the archive and validate the extension.
Thanks in advance.

Getting error: package android.views does not exist

$
0
0

Recently upgrade to Visual Studio 15.7.2 and I started getting a bunch of javac errors, most of them:
error: package android.views does not exist
There are a couple other packages missing, and then some items that are missing because I think others are failing.
Problem is I don't know what these packages are, or where they are supposed to be/

A couple of blogs/stackoverflow answers suggested deleting .../appdata/local/xamarin/xamarin.* (or android.*)
I don't know if 2017 uses these files anymore.
I've also tried to uninstall and reinstall.

The code should be fine, as it builds on my dev machine. But it fails on the build machine. (On my dev machine, I removed the aforementioned files in the xamarin directory, and they don't come back. Which leads me to believe they are no longer used)

We normally use msbuild to build, but it fails under visual studio as well.
We build by first copying the code down from our source control, so there are no build files lying around, so a clean and/or restarting visual studios won't help. And the nuget packages are also fresh.

The SDK of the build machine is very similar to the SDK on my dev machine (a few of the minor versions are different)
These branches also used to build on the build machine as well.

We are building against Oreo 8.0, using Xamarin Forms 2.5 (this all started when I tried to upgrade to 3.0, but I've since backed out the 3.0 changes)
JDK 1.8.0_161

there has to be something missing or corrupt on my build machine, I just can't figure out what it is.

I tried to reinstall VS 15.6.7 (this is the latest I could rollback to)
This time a the files in ../appdata/local/xamarin were restored. But it didn't help. I'm still getting the same errors.


1 template page multiple pages.

$
0
0

i can't find someone else who asked this and im sure it's been asked.

I have a list of objects. how do i set it up so one template page can be used for all the objects? i was looking at the data binding hoping there would be some mention of this but i can't find anything about this. from "xamarin-forms/user-interface/listview/data-and-databinding" on Microsoft docs pages.

users will be shown a list of items populated by the list of objects. when a user clicks on one of those items I want it to go to a new page and fill with that items specific information.

this way I have 2 pages to display about 50 items rather than making each page.

With java I could pass the item through the link but for this, I really don't know what to try or do. I'm not even sure if data binding is the correct spot to look in. it seemed like the right area given it allows you to display info from a database.

WebView scrolled event

$
0
0

Dear all community,

I need to know when the user has ended the scroll on a webview displaying a agreement, to display an "Accept" only when the user has read this.

Here is my webview (axml) :

  <WebView x:Name="webView" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
    <WebView.Source>
      <HtmlWebViewSource Html="{Binding Content}" />
    </WebView.Source>
  </WebView>

How can I do that ?..
I'm new on Xamarin, thanks for your help ;)

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>

MVVM best practise to access pages elements in viewmodel

$
0
0

Hi Guys,
i am new into mobile app developing and also into xamarin forms.
i build a xamarin forms application and i try to use the mvvm pattern.

What i try to achieve is like a simple form post in web developing.

I have a ContentPage (MyPage.xaml) with multiple Entrys, a ViewModel (MyPageViewModel.cs) which is bound to the ContentPage and my code behind (MyPage.xaml.cs). As far as i understood all the business logic should be in the ViewModel.

What i am now trying to do is reading all the data the user wrote into the entrys and afterwards i do whatever i want to do with this data.
How can i access the view elements in my viewmodel?

Or what is the best practice to work with the pages elements? In the code behind i can access them via this.findbyname("name").

Thank you for your help, Gelatto

Establish a connection between client and server.

$
0
0

I want to establish a connection between a client and the server. The client is Gateway and the server is Wi-Fi. What I have to do that I need to send a request from the client to the server which will carry passkey and ssid of Wi-Fi then the server will authenticate it if I have passed correct passkey.

Client Ip- "192.168.4.1"
ssid- abcd
passkey-abcd
Server Ip-"192.168.4.10".

Xamarin LiveReload - Just does nothing

$
0
0

After 3 days of beating on a brand new "Welcome to Xamarin" solution trying to get LiveReLoad to work... The best I can get is for the solution to not crash at launch.

The solution runs on both emulator and physical device. But changes in the XAML are not reflected in the running solution.
The setup instructions are pretty cut and dried:

  • Install the VSIX
  • Install the Nuget
  • Add the init call in the app class.
  • Rebuild
  • Deploy
  • Debug (F5) (Instructions say its not required. That should be listening regardless to 1 or more clients. But tried anyway)
  • Make changes in XAML and save.
  • Changes are sent to the running app when you save.
    Only they aren't.
    Does anyone see a key step I missed there?

Firewall is off
VS2017 v15.7.2
XamForms: v.Today
LiveReload: v.0.3.27

I've tried Connect from Visual studio both before and after launching on the emulator and physical device.

I am on a corporate domain network. Anyone had success on a domain?

ListView Scroll issue (middle of the screen)

$
0
0

List view works fine except cannot scroll down (scrolling up is fine) from the middle of the screen. Can scroll from left or the right side of the screen. I know it's weird. Anybody dealt with this issue? Thanks.


Unhandled Exception: Java.Lang.NoSuchMethodError: no method with name='getShadowRadius' signature='

$
0
0

This only happens when I deploy to a Kindle Fire Tablet. Doesn't happen on my Android phone or uwp.

Any ideas? Where would I even start looking in Xamarin Forms? I'm stumped!

Unhandled Exception:

Java.Lang.NoSuchMethodError: no method with name='getShadowRadius' signature='()F' in class Landroid/widget/TextView;

XA0106 Warnings

$
0
0

Hi guys.. I have around 180 Warnings in my Xamarin.Forms project, after I added today ThriveGmbH.BottomNavigationBar.XF nugget package. How can I solve this warnings? Here you have a few examples:

/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Animation.design_fab_in. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Animation.design_fab_out. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.MediaRouteControllerWindowBackground. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteBluetoothIconDrawable. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteCastDrawable. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteChooserPrimaryTextStyle. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteChooserSecondaryTextStyle. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteCollapseGroupDrawable. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteConnectingDrawable. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteControllerPrimaryTextStyle. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteControllerSecondaryTextStyle. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteControllerTitleTextStyle. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)
/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/Android/Xamarin.Android.Common.targets(2,2): Warning XA0106: Skipping P3Comm.Droid.Resource.Attribute.mediaRouteExpandGroupDrawable. Please check that your Nuget Package versions are compatible. (XA0106) (P3Comm.Droid)

Best way to pass data from code-behind to view model when using strict MVVM

$
0
0

Scenario:
I'm using a barcode scanner API in my view which seems to require me to hook up an event in the code-behind file as the only way to get the scanned barcode. When the barcode is scanned I want to pass the data on to the view model but since I want to follow the MVVM pattern I don't want a reference to the view model from my code-behind.

Right now I solved it by using the built in MessagingCenter.
Since the subview is showing within another view, there is no navigation taking place where I can pass on data from one vm to another.

Question:
Is MessagingCenter the best solution for this?

Sub question:
What is the best way to pass data between two view models for views showing at the same time (no navigation occurs)? I'm using MessagingCenter for this too right now.

How to center image in toolbar in xamarin forms

$
0
0

Basically I want to center image in the toolbar in my app
I tried to do that manually in android toolbar by modifying native toolbar to

<?xml version="1.0" encoding="utf-8"?>
<android.support.v7.widget.Toolbar xmlns:android="http://schemas.android.com/apk/res/android"
    android:id="@+id/toolbar"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:background="#536474"
    android:theme="@style/ThemeOverlay.AppCompat.Dark.ActionBar"
    android:popupTheme="@style/ThemeOverlay.AppCompat.Light"
    >
  <RelativeLayout
      android:layout_width="match_parent"![](https://us.v-cdn.net/5019960/uploads/editor/fq/cv80gfxsaxxq.png "")

      android:layout_height="match_parent">
    <ImageView
        android:id="@id/image"
        android:layout_height="wrap_content"
        android:layout_width="wrap_content"
        android:paddingTop="5dp"
        android:paddingBottom="5dp"
        android:layout_centerInParent="true"
        android:baselineAlignBottom="true"
        android:scaleType="fitCenter"
        android:src="@drawable/toolbarlogo"
            />
  </RelativeLayout>


</android.support.v7.widget.Toolbar>

But the result is
https://imgur.com/KNjLVgB

and aligned right when navigation to page have a naviagionbar also how to do that in ios ?

Creating A Tutorial App

$
0
0

Hi guys I hope this is the right place to ask about newbie questions. So I have completed learning the XAML Basics until the MVVM part and I decided to make my first android app. Then I have an idea to create a tutorial app that contains text and image (and gif if possible). I think it's the simplest app that comes in my mind. But I have one question for now. This is probably the dumbest question ever but do I have to write all the contents in the xaml file or write the contents in another file and call it to my view model ? Thanks and please forgive my bad english. :)

Viewing all 89864 articles
Browse latest View live


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