How-to: Display a Dialog (modal or flyout) #20609
-
I am trying to follow the instructions "HOw-To:Display a Dialog (modal or flyout) I created a new uno-application with the following command line dotnet new unoapp -o DialogTest -preset "recommended" -platforms "desktop" -presentation "mvvm" -dsp False -theme-service False` This generate a text box to enter a name and a button to go to the second page. I added the buttons specified in the instructions to this page I added SamplePAge.xaml,buttons in mainpage.xaml and ShowDialogClick method in MainPage.xaml.cs per the instructions When I first tried to run the application, the compile failed with the message "error CS0246: The type or namespace name 'SamplePage' could not be found '. I deduced that this was because ShowDialog.Views did not exist in my project. I changed the first line of SamplePage.xaml to specify "x:Class="DialogTest.Presentation.SamplePage"" Now the application compiles. When I click on the Show flyout button the ShowDialogClick is invoked but fhe application then fails to run to run with the message
Please advise |
Beta Was this translation helpful? Give feedback.
Replies: 4 comments 3 replies
-
Hey @HowardPWeiss, Thank you for your question and the repro steps. Can you also share the project you've been working with please? It is always better for us to test directly with it. Thanks. |
Beta Was this translation helpful? Give feedback.
-
I do not usually use GitHub. I tried to create a repository on GitHub and upload my project but GitHub desktop wont't let me publish to repository (bad Credentials) so I am attaching a .zip of the project (having deleted the bin and obj folders) |
Beta Was this translation helpful? Give feedback.
-
Dominik - I am developing with Visual Studio Code on Linux. I tried using File New but it only allows me to create a text file, regardless of extension. Hence, no automatically generated .xaml.cs file. Perhaps someone could update the document describing how to create a dialog to include generating a .xaml.cs file Also, I notice that there are other differences between the files you sent and files generated by dot new the program.cs you sent invokes
whereas the file generated by dotnet new invokes
the sample.xaml you sent is as follows `
` whereas the file from the instructions which I copied from the instructions is `
` Howard |
Beta Was this translation helpful? Give feedback.
-
Dominik - Further comment: sample.xaml from you ` `sample.xaml from instructions `
Howard |
Beta Was this translation helpful? Give feedback.
Interesting... I tested your project with the latest Uno.Sdk 6.0.96 and simply added a
SamplePage.xaml.cs
file. The Uno template in Visual Studio should create it automatically, but for some reason, it was missing on your end:Now the page (or dialog when you change Page to ContentDialog) displays correctly. Here is the project again with the changes:
DialogTest.zip
Let me know, if this helps.