码迷,mamicode.com
首页 > 编程语言 > 详细

分析一段XAML语言代码

时间:2020-02-21 18:26:11      阅读:87      评论:0      收藏:0      [点我收藏+]

标签:语言   source   temp   design   包名   rabl   bsp   wpf   bind   

分析WPF的一段xaml代码:

 1 <UserControl x:Class="UserControl1"
 2              xmlns="..."
 3              xmlns:x="..."
 4              xmlns:mc="..."
 5              xmlns:d="..." 
 6              xmlns:local="clr-namespace:WpfApp3"  
 7              mc:Ignorable="d" 
 8              d:DesignHeight="450" d:DesignWidth="800">
 9     <Grid>
10         <Border BorderBrush="Blue" BorderThickness="2" Margin="5,3">
11             <ListBox ItemsSource="{Binding Datas}" SelectedItem="{Binding SelectedData}">
12                 <ListBox.ItemTemplate>
13                     <DataTemplate>
14                         <Border Background="LightGreen" BorderBrush="LightYellow" BorderThickness="1" Margin="1">
15                             <StackPanel Orientation="Horizontal">
16                                 <TextBlock Width="100" Text="{Binding Name}" />
17                                 <TextBlock Margin="10,0,0,0" Text="{Binding Age}" Width="100"/>
18                             </StackPanel>
19                         </Border>
20                     </DataTemplate>
21                 </ListBox.ItemTemplate>
22             </ListBox>
23         </Border>   
24     </Grid>
25 </UserControl>

代码

解释

xmlns:local="clr-namespace:WpfApp3"

 

  包名

DesignHeight="450"

窗体的高

DesignWidth="800"

窗体的宽
BorderBrush="Blue"  外部边框颜色
BorderThickness="2"  边框厚度
Margin="1"

四个边距都是 1px

Margin="5,3"

上边距和下边距是 5px

右边距和左边距是 3px

margin:10px 5px 15px;
  • 上边距是 10px
  • 右边距和左边距是 5px
  • 下边距是 15px
ListBox ItemsSource="{Binding Datas}"  
ListBox SelectedItem="{Binding SelectedData}"  
<ListBox.ItemTemplate>  
<DataTemplate>  

分析一段XAML语言代码

标签:语言   source   temp   design   包名   rabl   bsp   wpf   bind   

原文地址:https://www.cnblogs.com/qq2806933146xiaobai/p/12342070.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!