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
本文深入探讨了基本控件如文本框、标签、按钮等在应用程序设计中的应用,包括如何通过属性如TabIndex、AcceptsReturn、SpellCheck等进行定制。文章还展示了如何使用FocusManager进行元素聚焦管理,并介绍了文本块、标签和文本输入控件的使用场景。此外,文章详细介绍了按钮控件的属性和事件处理,以及如何实现简单的保存功能。最后,通过实例展示了如何利用这些控件进行布局设计。
224

被折叠的 条评论
为什么被折叠?



