The code uses the ContentDialog control to display a welcome message in a modal popup control within the current window. Here's the code to copy and paste: private async void myButton_Click(object sender, RoutedEventArgs e)Ĭontent = "Welcome to your first Windows App SDK app.", The default event handler looks like this: In Solution Explorer, double-click, the code-behind page.Įdit the event handler code in the C# editor window that opens. In this case, it adds an action triggered by the "Hello World!" button. We'll get to that in the next step.Īn "event handler" sounds complicated, but it's just another name for code that is called when an event happens. Notice that the button has a Click event handler named myButton_Click specified, too. In the XAML Editor, change Button Content value from "Click me" to "Hello World!". Review the Button control nested within the StackPanel at the root of the Window. Unlike UWP projects, WinUI 3 doesn't have a Design view. The XAML Editor is where you can add or change markup. In the Solution Explorer, double-click MainWindow.xaml to open the XAML markup editor. You'll add a button control, add an action to the button, and then run the "Hello World" app to see what it looks like. When the package installation is complete, close the Settings dialog box. Visual Studio installs an additional Developer Mode package for you. Choose Developer mode, and then choose Yes. If this is the first time you have used Visual Studio to create a Windows App SDK app, a Settings dialog box might appear.
0 Comments
Leave a Reply. |