星空网 > 软件开发 > ASP.net

silverlight简单数据绑定

.cs类

  public class Person  {     public String Name { get; set; }     public int Age { get; set; }         public String Address { get; set; }     } 

 

.xaml.cs

    void LayoutRoot_Loaded(object sender,RoutedEventArgs e)    {      Person person = new Person()      {       Name="Terry",       Age=20,       Address="Beijing"      };      this.LayoutRoot.DataContext = person;    }     

.xaml

 <Grid x:Name="LayoutRoot" Background="white" Loaded="LayoutRoot_Loaded">    <StackPanel>    <TextBlock Grid.Row="1" Grid.Column="1" HorizontalAlignment="Left" Text="{Binding Name}"/>    <TextBlock Grid.Row="2" Grid.Column="1" HorizontalAlignment="Left" Text="{Binding Age}"/>    <TextBlock Grid.Row="3" Grid.Column="1" HorizontalAlignment="Left" Text="{Binding Address}"/>    </StackPanel>  </Grid>

 


 

 

 




原标题:silverlight简单数据绑定

关键词:

*特别声明:以上内容来自于网络收集,著作权属原作者所有,如有侵权,请联系我们: admin#shaoqun.com (#换成@)。

澳洲365国际快递:https://www.goluckyvip.com/tag/101033.html
国际快递进口:https://www.goluckyvip.com/tag/101034.html
ems国际快递海运:https://www.goluckyvip.com/tag/101035.html
晋江国际快递:https://www.goluckyvip.com/tag/101036.html
国际快递 找客户:https://www.goluckyvip.com/tag/101037.html
澳洲国际快递:https://www.goluckyvip.com/tag/101038.html
美国版权小知识-哪些作品能够登记美国版权?:https://www.kjdsnews.com/a/1836627.html
俄罗斯汽车企业进口东风汽车零部件组装雪铁龙汽车:https://www.kjdsnews.com/a/1836628.html
相关文章
我的浏览记录
最新相关资讯
海外公司注册 | 跨境电商服务平台 | 深圳旅行社 | 东南亚物流