c # UWP controls Button (B)

Define and create buttons

 In the xaml:
      Button syntax in xaml defined way is very simple, but if you want to really understand the origin of the definition of the way, you need to understand a parent --ContentControl class button class. Common such as Button, CheckBox, and ScrollViewer and other types of controls, directly inherited from ContentControl class. All controls are inherited from ContentControl contains the following three-defined format:

The first: by direct assignment to initialize the button for the Content property. For buttons in terms of content Content is the button text.             
<Button Content="开始"/>

 

The second: a user-defined function buttons act as a UI element, rather than the traditional button shape. In this case, like a button panel layout, the entire content of which presents a button

<Button><Rectangle Height="28" Width="60" /></Button>

 

The third: a simple string contains only elements responsible for initializing the button text               

<Button>开始</Button>

 

In C #:

Button myButton = new Button();
myButton.Content = "开始";

 

Guess you like

Origin www.cnblogs.com/flyarrow/p/11854941.html
UWP