This translation, if there is no wrong can be sent mailbox
To create a page, you can display the data through a button, a textbox input, a combo box, and get user input. There are three key steps you can use to add a control:
Add a control to the interface
Set control properties, height, width, color
Adding events for a control
Adding controls
You can add controls in any of the following ways
Using the interface to drag the control directly, blend directly in the toolbox to drag the control to the interface
Click button to drag the button interface
Editing in XAML<Button Content="确定"></Button>
Code Add control
In Visual Studio, you can use the Toolbox, XAML editor, designer, Properties window
- Toolbox
- XAML Editor
- Designer
- Properties window
The toolbox shows a lot of controls that you can use in software, you can drag controls to the interface, you can double-click controls, and the controls are automatically added to the software.
Double-click TextBox
<TextBox x:Name="textBox" TextWrapping="Wrap"Text="TextBox"/>
naming controls
In order to change the control in code, you can give the control name, x:Name write the control name, control name cannot be repeated, cannot start with a number
You can use properties to name controls
Click the control, and in the properties you can see
Name of the control to write on
Setting control Properties
You can select a control property in a property
You can edit XAML write controls
If you set the one you don't, you can reset the property
Click Re-set
You can use the following color table to set the color
Write Visual Studio in XAML when you press a key, you are prompted
Control events
Each control has a number of events, you can use XAML, property creation events, and the method of creating events is event handling, see: https://msdn.microsoft.com/windows/uwp/xaml-platform/ Events-and-routed-events-overview
Create events can be in the properties
Select event, write name, press ENTER, go to CS, event handling the first parameter is sender, reference object, second is event data
We create a click
privatevoidButton_Click(object sender, Windows.UI.Xaml.RoutedEventArgs e) { as Button;//sender 发送者 }
If a button name is given, the code can be
Original: Https://msdn.microsoft.com/windows/uwp/controls-and-patterns/controls-and-events-intro
Win10 UWP Intro to controls and events