【问题标题】:Save swipe item to firebase realtime in xamarin form以 xamarin 形式将滑动项目实时保存到 firebase
【发布时间】:2023-01-16 20:50:20
【问题描述】:

我想将选择的滑动保存到 firebase。 但我不知道该怎么做,也找不到任何互联网解决方案。

这是我在滑动视图中的代码

<SwipeView x:Name="swipe_orderstatus">

                                    <SwipeView.RightItems >
                                        <SwipeItems >
                                            <SwipeItem Text="Received"
                                                       BackgroundColor="#73a9c2"
                                                     
                                                       
                                                      Invoked="SwipeItem_Invoked_1"
                                                />
                                            
                                        </SwipeItems>
                                    </SwipeView.RightItems>

</SwipeView>

那么这就是我在后面的代码中尝试过的。

  private void SwipeItem_Invoked_1(object sender, EventArgs e)
        {
            //  string swipeIt
            //  string swipeViewItem= swipe var picker = (Picker)sender;
            //    int selectedIndex = picker.SelectedIndex;
            var swipeView = (SwipeView)sender;
            string swipeViewItem= swipeView
        }

先感谢您。

【问题讨论】:

    标签: firebase-realtime-database xamarin.forms swipe


    【解决方案1】:

    您可以使用BindingContext获取所选项目

    var swipeView = (SwipeView)sender;
    var item = (MyClass)swipeView.BindingContext;
    

    其中 MyClass 是代表您的模型的类的名称

    【讨论】:

      猜你喜欢
      • 2018-02-19
      • 2022-12-01
      • 1970-01-01
      • 1970-01-01
      • 2014-12-26
      • 1970-01-01
      • 1970-01-01
      • 2021-09-08
      • 1970-01-01
      相关资源
      最近更新 更多