wpf 研习1-24小时自学wpf5

basic Control

 

Control base class derives from FrameWorkElement base class;

(property-TabIndex)

 

 

Text:

TextBlock,Label,TextBox for input;(property-AcceptsReturn,AcceptsTab,SpellCheck.IsEnabled,ToolTip)

 

 FocusManager.FocusedElement=”{Binding ElementName=firstName}”

 

<Label Content=”_First Name:” Target=”{Binding ElementName=firstName}” />

<TextBox x:Name=”firstName” Grid.Column=”1” />

<Label Grid.Row=”1” Content=”_Last Name:” Target=”{Binding ElementName=lastName}” />
<TextBox x:Name=”lastName” Grid.Row=”1” Grid.Column=”1” />

 

TextBlock inherits from FrameworkElement;

Label inherits from ContentControl;

 

Button:

Button, ToggleButton(RadioButton, CheckBox)-inherit from ButtonBase(ButtonBase inherit from ContentControl);(property-AccessText)

 

 <Button Grid.Row=”4”
               Grid.Column=”1”
               HorizontalAlignment=”Right”
               Content=”Save”
               Click=”Button_Click” />

 

private void Button_Click(object sender, RoutedEventArgs e){
              MessageBox.Show(“Contact saved.”, “Save”);
}

 

ListBox

 

 

 

 

 

你可能感兴趣的:(WPF)