Buttons Appear Disabled in MvxListView Item Template with MvvmCross in Xamarin Android

82 Views Asked by At

I'm working on an Android application using MvvmCross, and I'm facing an issue where buttons inside a MvxListView item template appear disabled (greyed out) and do not respond to clicks.

Here's the XML code for the layout containing the MvxListView:

<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent">
  
    <Mvx.MvxListView
        android:layout_width="wrap_content"
        android:layout_height="match_parent"
        android:layout_toStartOf="@+id/addButton"
        local:MvxItemTemplate="@layout/product_view"
        local:MvxBind="ItemsSource FilterProduct; ItemClick ShowProductDetailsCommand"
        android:layout_marginStart="20dp"
        android:layout_marginTop="15dp"
        android:layout_marginRight="20dp"
        android:layout_marginLeft="30dp" />
</RelativeLayout>

And this is the item template that contains the button:

<?xml version="1.0" encoding="utf-8"?>
<LinearLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:local="http://schemas.android.com/apk/res-auto"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:orientation="vertical"
    android:background="#ff263238">

    <LinearLayout
        android:orientation="horizontal"
        android:minWidth="25px"
        android:minHeight="25px"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:id="@+id/linearLayout2">

        <TextView
            android:id="@+id/productName"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:textColor="#FFFFFF"
            local:MvxBind="Text NameProduct"/>
        <Button
            android:id="@+id/addButton"
            android:layout_width="wrap_content"
            android:layout_height="wrap_content"
            android:layout_gravity="end"
            android:text="+"
            local:MvxBind="Click AddProductCommand"
            />
    </LinearLayout>
</LinearLayout>

The buttons appear but are not active. They are greyed out and I have checked the viewmodel and everything is connected, I have checked but have not been able to give or understand why it is still like this.

I attach an image: https://i.ibb.co/PFhSLr0/e980c2f4-ebf4-4fd7-b1ae-fb1549c3ec48.jpg

0

There are 0 best solutions below