1、GridSplitter 分割线,表示重新分布 Grid 控件的列间距或行间距的控件。
XAML
1 2 3 4 5 6 7 8 |
<Grid> <Grid.ColumnDefinitions> <ColumnDefinition/> <ColumnDefinition/> </Grid.ColumnDefinitions> <GridSplitter Grid.Column ="0" Background="Blue" Width="5" HorizontalAlignment="Right" VerticalAlignment="Stretch"/> </Grid> |
C#
1 2 3 4 5 6 |
GridSplitter mySimpleGridSplitter = new GridSplitter(); Grid.SetColumn(mySimpleGridSplitter, 0); mySimpleGridSplitter.Background = Brushes.Blue; mySimpleGridSplitter.HorizontalAlignment = HorizontalAlignment.Right; mySimpleGridSplitter.VerticalAlignment = VerticalAlignment.Stretch; mySimpleGridSplitter.Width = 5; |
2、GroupBox 具有标题的容器盒子,该控件用于创建具有用户界面 (UI) 内容边框和标题的容器。
3、Image 图片控件 source属性设置图片路径
4、Label 文本标签 不支持换行 Content属性内为显示的文本
5、ListBox 列表选择组件,可以横向也可以竖向,能获取选中值。可使用Separator控件做分隔符。
XAML
1 2 3 |
<TextBox Name="tb" Width="140" Height="30"></TextBox> <ListBox Name="lb" Width="100" Height="55" SelectionChanged="PrintText" SelectionMode="Single"> <ListBoxItem>Item 1</ListBoxItem> |
4 5 6 7 8 9 10 11 12 13 |
<ListBoxItem>Item 2</ListBoxItem> <ListBoxItem>Item 3</ListBoxItem> <ListBoxItem>Item 4</ListBoxItem> <ListBoxItem>Item 5</ListBoxItem> <ListBoxItem>Item 6</ListBoxItem> <ListBoxItem>Item 7</ListBoxItem> <ListBoxItem>Item 8</ListBoxItem> <ListBoxItem>Item 9</ListBoxItem> <ListBoxItem>Item 10</ListBoxItem> </ListBox> |
C#
1 2 3 4 5 6 7 |
void PrintText(object sender, SelectionChangedEventArgs args) { //获取当前列表选择项 ListBoxItem lbi = ((sender as ListBox).SelectedItem as ListBoxItem); //把选择项赋值给文本 tb.Text = "你选择了" + lbi.Content.ToString() + "."; } |