MainPage.xaml
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 | <?xml version="1.0" encoding="utf-8" ?> <ContentPage xmlns="http://xamarin.com/schemas/2014/forms" xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml" xmlns:local="clr-namespace:App12PopUp" x:Class="App12PopUp.MainPage"> <AbsoluteLayout> <!-- Main Page Content --> <StackLayout AbsoluteLayout.LayoutBounds="0, 0, 1, 1" AbsoluteLayout.LayoutFlags="All"> <Button x:Name="btnPop" Text="팝업창 호출" FontSize="Large" VerticalOptions="CenterAndExpand" HorizontalOptions="CenterAndExpand"> </Button> </StackLayout> <!-- Overlay --> <ContentView x:Name="overlay" AbsoluteLayout.LayoutBounds="0,0,1,1" AbsoluteLayout.LayoutFlags="All" IsVisible="False" BackgroundColor="#C0808080" Padding="10, 0, 10, 0"> <StackLayout Orientation="Vertical" BackgroundColor="White" HorizontalOptions="Center" VerticalOptions="Center" Padding="10"> <Label FontSize="18" TextColor="Black" HorizontalOptions="Fill" Text="팝업" /> <StackLayout Orientation="Horizontal" HorizontalOptions="Center"> <Button x:Name="btnPopCancel" Text="닫기" FontSize="Large" VerticalOptions="CenterAndExpand" HorizontalOptions="Center"/> </StackLayout> </StackLayout> </ContentView> </AbsoluteLayout> </ContentPage> | cs |
MainPage.xaml.cs
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 | using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Xamarin.Forms; namespace App12PopUp { public partial class MainPage : ContentPage { public MainPage() { InitializeComponent(); this.btnPop.Clicked += BtnPop_Clicked; this.btnPopCancel.Clicked += BtnPopCancel_Clicked; } private void BtnPopCancel_Clicked(object sender, EventArgs e) { overlay.IsVisible = false; } private void BtnPop_Clicked(object sender, EventArgs e) { overlay.IsVisible = true; } } } | cs |
실행
https://www.c-sharpcorner.com/article/display-popup-using-absolute-layout-in-xamarin-forms/
'프로그래밍 > xamarin' 카테고리의 다른 글
[xamarin]어플 닫기 전에 물어보고 닫기 (0) | 2018.06.24 |
---|---|
[xamarin]Lottie Animation (0) | 2018.06.10 |
[xamarin]CustomRenderers (0) | 2018.06.03 |
[xamarin]Alert Dialog (0) | 2018.05.27 |
[xamarin] Profile UI Design (0) | 2018.05.20 |