Пакет nuget Rg.Plugins.Popup (1.2.0.223), дающий cra sh для проекта UWP Xamarin - PullRequest
2 голосов
/ 09 января 2020

Я добавил последнюю версию пакета Rg.Plugins.Popup 1.2.0.223 для проекта Xamarin Uwp и Init, который контролирует PopUp в файле App.xaml.cs решения Uwp.

Затем я создал одну всплывающую страницу Xaml и вызвал его из файла Mainpage.xaml.cs, используя метод, вызвав его, давая вызов cra sh и debugger.Break ().

/*App.xaml.cs this file Init Popup Control*/
      protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;
                Rg.Plugins.Popup.Popup.Init();
                Xamarin.Forms.Forms.Init(e);

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }

    /*PopUp Control Xaml code*/
          <?xml version="1.0" encoding="utf-8" ?>
            <pages:PopupPage
            x:Class="ProjectName.DashboardBrush.DashbordDistrictPage"
            xmlns="http://xamarin.com/schemas/2014/forms"
            xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
            xmlns:pages="clr-namespace:Rg.Plugins.Popup.Pages;assembly=Rg.Plugins.Popup"
            xmlns:prism="clr-namespace:Prism.Mvvm;assembly=Prism.Forms"
            prism:ViewModelLocator.AutowireViewModel="True">
            <StackLayout
                Margin="5,50,0,0"
                Padding="1"
                BackgroundColor="White"
                HeightRequest="420"
                HorizontalOptions="StartAndExpand"
                VerticalOptions="Start"
                WidthRequest="200">
                <Frame BorderColor="Black">
                    <ListView
                        x:Name="districtListView"
                        CachingStrategy="RecycleElement"
                        ItemTapped="Handle_ItemTapped"
                        ItemsSource="{Binding Items, Mode=TwoWay}"
                        RowHeight="50"
                        SeparatorColor="Black"
                        VerticalScrollBarVisibility="Never">
                        <!--  Built in Cells  -->
                        <ListView.ItemTemplate>
                            <DataTemplate>
                                <TextCell Text="{Binding .}" />
                            </DataTemplate>
                        </ListView.ItemTemplate>
                    </ListView>
                </Frame>
            </StackLayout>
        </pages:PopupPage>


/*Method From which Popup page is calling*/    
    async void FilterOptionClicked(object sender, EventArgs e)
        {
            var dashboardFilterView = new DashboardBrushFilter(dashboardViewModel.selectedFilters.ToArray());
            await PopupNavigation.Instance.PushAsync(dashboardFilterView);
        }
...