如何在xamarin表单中显示列表视图项弹出窗口

如何在xamarin表单中显示列表视图项弹出窗口,xamarin,xamarin.forms,xamarin.ios,popup,Xamarin,Xamarin.forms,Xamarin.ios,Popup,你好,开发者,我想在我的页面中显示pop。我要显示的给定图像链接红色部分,请帮助我如何以xamarin形式显示 Hello Xamarin developer I have attach one image link in this question .This image red mark portion I want display on my page how can I do that 不确定ListView的内容是什么,但这里有一个简单的弹出窗口示例,其中包含ListView,因此

你好,开发者,我想在我的页面中显示pop。我要显示的给定图像链接红色部分,请帮助我如何以xamarin形式显示

Hello Xamarin developer I have attach one image link in this question .This image red mark portion I want display on my page how can I do that


不确定ListView的内容是什么,但这里有一个简单的弹出窗口示例,其中包含ListView,因此您可以根据需要调整它

XAML

<?xml version="1.0" encoding="UTF-8"?>
<ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" x:Class="TestPopUp.MainPage">
   <AbsoluteLayout Padding="0" HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
      <StackLayout HorizontalOptions="FillAndExpand" VerticalOptions="FillAndExpand">
         <Button Text="Pop up!" VerticalOptions="CenterAndExpand" HorizontalOptions="Center" Clicked="Button_Clicked" />
      </StackLayout>

      <ContentView x:Name="popupView" BackgroundColor="Transparent" Padding="10, 0" IsVisible="false" AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All">
         <StackLayout VerticalOptions="Center" HorizontalOptions="Center">
            <Frame CornerRadius="10" Padding="0" BorderColor="LightGray">
               <StackLayout Orientation="Vertical" HeightRequest="300" WidthRequest="200" BackgroundColor="White">
                  <ListView SeparatorVisibility="None" ItemsSource="{Binding MyList}" VerticalScrollBarVisibility="Never">
                     <ListView.ItemTemplate>
                        <DataTemplate>
                           <ViewCell>
                              <Label Text="{Binding .}" />
                           </ViewCell>
                        </DataTemplate>
                     </ListView.ItemTemplate>
                  </ListView>
               </StackLayout>
            </Frame>
         </StackLayout>
      </ContentView>

   </AbsoluteLayout>
</ContentPage>
    public partial class MainPage : ContentPage
    {
        public ObservableCollection<string> MyList { get; set; } = new ObservableCollection<string>();
        public MainPage()
        {
            InitializeComponent();
            MyList.Add("Item 1");
            MyList.Add("Item 2");
            MyList.Add("Item 3");
            MyList.Add("Item 4");
            MyList.Add("Item 5");
            MyList.Add("Item 6");
            MyList.Add("Item 7");
            BindingContext = this;
        }

        private void Button_Clicked(object sender, EventArgs e)
        {
            popupView.IsVisible = true;
        }
    }


因此,当您想显示此弹出窗口时,只需将
popupView.IsVisible=true
放在代码框中即可。

可以使用网格,请发布您的页面代码。我该怎么做,您有什么参考资料吗that@priyankapawar如果您使用的是prism体系结构,那么请使用prism对话服务来实现您想要的结果。这可能会有帮助