PrismLibrary / Prism.Maui

This is an experimental repo. The code here will eventually be merged into the main Prism repo as a full fledged platform at which time this repo will be archived.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Dialog doesn't appear when setting height and width

nikoslyk203 opened this issue · comments

commented

I am trying to open a dialog but when I set the height and width the dialog doesn't appear and I see only the gray background. Also a second problem I encountered is when I tap the background and the event is fired the application hangs.
I had the same implementation on Xamarin Forms and it was working fine.

Xaml Code

<?xml version="1.0" encoding="utf-8" ?>
<Frame x:Class="MyProject.Views.AddShoppingItemPopupPage"
       xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
       xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
       xmlns:prismDialog="clr-namespace:Prism.Services.Xaml;assembly=Prism.Maui"
       xmlns:local="clr-namespace:MyProject.ViewModels;assembly=DailyOrganizer"
       x:Name="AddShoppingItemPopup"
       prismDialog:DialogLayout.RelativeHeightRequest="0.5"
       prismDialog:DialogLayout.RelativeWidthRequest="0.9"
       BackgroundColor="#FAFAFA"
       Opacity="0">

    <prismDialog:DialogLayout.Mask>
        <BoxView
            x:Name="BG"
            BackgroundColor="Black"
            Opacity="0">
            <BoxView.GestureRecognizers>
                <TapGestureRecognizer Tapped="TapGestureRecognizer_Tapped"/>
            </BoxView.GestureRecognizers>
        </BoxView>
    </prismDialog:DialogLayout.Mask>

    <StackLayout Orientation="Vertical">
        <Label Text="Description"/>
        <Entry Text="{Binding ShoppingItem.Name}"/>

        <Label Text="Quantity"/>
        <Entry Text="{Binding ShoppingItem.Quantity}"/>

        <Button Text="Insert" Command="{Binding InsertNewShoppingItemCommand}"/>
    </StackLayout>
</Frame>

Code Behind

public partial class AddShoppingItemPopupPage
{
	public AddShoppingItemPopupPage()
	{
		InitializeComponent();
		AnimateAppearance();
	}

	private async Task AnimateAppearance()
	{
		await Task.Delay(125);
		AddShoppingItemPopup.FadeTo(1, 125);
		await BG.FadeTo(0.3, 250);
	}

	private async void TapGestureRecognizer_Tapped(object sender, TappedEventArgs e)
	{
		await BG.FadeTo(0, 250);
		await AddShoppingItemPopup.FadeTo(0, 125);
	}
}

Dialog service

var result = await dialogService.ShowDialogAsync(nameof(AddShoppingItemPopupPage));

Can you please provide a sample that demonstrates the issue. While we appreciate that you've provided some relevant sample code there, we do not have time to create reproductions of issues for everyone. If you have a sample that reproduces the issue we can re-open the issue.

Also note that this is an open source library and we do accept PRs so if this is indeed a bug and you would like to contribute a fix we would be happy to consider it.