【问题标题】:How to hide MvxListView local:MvxItemTemplate linear layout in MVVMCross Xamarin Android如何在 MVVMCross Xamarin Android 中隐藏 MvxListView local:MvxItemTemplate 线性布局
【发布时间】:2022-11-06 15:09:52
【问题描述】:

我们正在尝试将 MVX 绑定用于模板线性布局的视图模型中的可见性,但它在我们的情况下不起作用,因为可见性在 main.axml 中有效,但不适用于模板,如果我们缺少任何内容,请联系我们 下面是一些代码sn-p

Main.axml    

<MvvmCross.DroidX.RecyclerView.MvxRecyclerView
                            android:id="@+id/mvx_list_basket"
                            android:layout_width="fill_parent"
                            android:layout_height="fill_parent"     
                            local:MvxBind="ItemsSource BasketObsList;ItemClick ItemSelectedCommand"
                            local:MvxItemTemplate="@layout/_itemtemplate"/>
            



_itemtemplate.axml            
                            
        <LinearLayout
            android:id="@+id/LayoutScheduleExist"
            android:gravity="center_vertical"
            android:layout_width="match_parent"
            android:layout_height="40dp"
            android:orientation="horizontal"
            local:MvxBind="Visibility Visibility(IsScheduleExist)">
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                local:MvxBind="Text ScheduleName"/>
            <TextView
                android:layout_width="wrap_content"
                android:layout_height="wrap_content"
                local:MvxBind="Text LabelDiscount"/>
        </LinearLayout>

【问题讨论】:

  • 并且安装了可见性插件?您是否在调试输出中看到有关绑定的任何警告?
  • 可见性插件工作但它不能在模板中工作,我们在大多数页面中都使用它....

标签: c# xamarin xamarin.android mvvmcross


【解决方案1】:

提供 _itemtemplate.axml 的完整内容。

附:您可以使用“本地:MvxBind=”可见 IsScheduleExist"" 为简单起见

【讨论】:

    猜你喜欢
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2016-06-30
    • 1970-01-01
    • 2016-09-20
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多