0

so I'm working with the XCT popup but hotreload doesn't work (I'm not sure if something is wrong on my end). I'm just finding it really annoying to have to restart my project each time when I'm placing images, I just can't get the positions right. I've tried using a frame on another content page then coping and pasting it to the popup page but the dimensions change when pasted. Does anyone have any solutions/tips for the best practice working with the XCT popup. Thanks

user2773611
  • 107
  • 2
  • 10
  • Hot Reload should just work, you only have to close the popup and open it again for the changes to show up. Maybe doesn't work for all of the changes you do, will work for most :) – Gerald Versluis Aug 19 '21 at 09:11
  • Thanks, I have tried opening and closing the popup to see the changes but unfortunately it seems that these are the changes that don't change :(. I guess I'll just have to clean and build my project to see that changes. – user2773611 Aug 19 '21 at 09:18

1 Answers1

0

If you want to use Xamarin.CommunityToolkit PopUp, you need to install Xamarin.CommunityToolkit firstly.

Then creating new contentpage, change contentpage as Popup

<xct:Popup
x:Class="mediasample.popup1"
xmlns="http://xamarin.com/schemas/2014/forms"
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:xct="http://xamarin.com/schemas/2020/toolkit"
Size="500, 500">
<StackLayout>
    <Image Source="waterfront.jpg" />
    <Button
        x:Name="btn1"
        Clicked="btn1_Clicked"
        Text="closewindow" />
</StackLayout>
</xct:Popup>

 public partial class popup1 :Popup
{
    public popup1()
    {
        InitializeComponent();
    }

    private void btn1_Clicked(object sender, EventArgs e)
    {
        Dismiss(this);
    }
}

Finally, you can navigate to Popup page.

 private void btn2_Clicked(object sender, EventArgs e)
    {
        Navigation.ShowPopup(new popup1());
        
    }

Note: You may get some error messages about Popup, if your code is ok, don't need to take care this error message, just clean and build your project. Because I also encounter this problem.

About hot reload, you also don't need to take care about this, because hot reload also have some problems although your code is ok, and Hot reload will disappear after Visual studio 16.8.

So just try to clean and build your project to see.

Cherry Bu - MSFT
  • 10,160
  • 1
  • 10
  • 16