空间类都继承自 System.Windows.Control
支持设置控件内容对齐方式
tab顺序
绘制背景,前景和边框
格式化文本内容的尺寸和字体
前景画刷,背景画刷
cmd.Background = new SollidColorBrush(Colors.AliceBlue);
系统画刷颜色SystemColors.ControlColor
cmd.Foregroud = new SolidColorBrush(Color.FromRgb(red,green,blue));
透明颜色画刷Color.FromArgb(); Alpha
XAML : <Button Background = "Red">A Button</Button>
字体:
<Button name=”cmd" FontFamily="Times New Roman" FontSize="18">A Button</Button>
或
cmd.FontFamily = "Times New Roman";
cmd.FontSize = "18";
字体嵌入
1、添加字体文件.ttf Build Action设置为Resource
2. <Label FontFamily="./#Bayern" FontSize="20">This is an embedded font</Label>
鼠标光标
System.Windows.Input.Cursor
this.Cursor = Cursors.Wait;
<Button Cursor="Help">Help</Button>
content属性
对齐内容
HorizontalContentAlignment
VeritcalContentAlignment
<Button Padding="3">Well Padded</Button>
标签label
Label Target 隐藏属性。
按钮buttonbase
Button
CheckBox
RadioButton
ClickMode属性
工具提示 tooltip
<Button ToolTip="This is my tooltip">I have a tooltip</Button>
提示放置策略
1.根据鼠标的当前位置
2.根据悬停鼠标的元素的位置
Placement Left Right Top Bottom
3.根据另一个元素(或窗口)的位置
4.使用偏移
5.使用绝对坐标
6.使用在运行时计算的结果
ToolTipService.InitialShowDelay="1"
<Button ToolTip="xxxxx" ToolTipService.Placement="Bottom">xxx</Button>
Popup
different between Popup and ToolTop
1 Popup不会自动显示需要设置它的IsOpen属性
2 Popup.StaysOpen
3 PopupAnimation进入视线的方式
4 可以接受焦点
5 在System.Windows.Controls.Primitive命名空间中
特殊容器控件
ScrollViewer
VericalScrollBarVisibility 禁止显示
LineUp() LineDown() PageUp() PageDown()
LineLeft() LineRight() PageLeft PageRight()
ScrollToEnd() ScrollToHome()
ISrollInfo自定义滚动
带标题的内容控件