大佬教程收集整理的这篇文章主要介绍了silverlight绑定总结,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
两种大类:
普通绑定,数据源通过datacontext指定。并且会对上级控件搜索数据源
datagrid等list类型绑定,数据源通过itemsource指定。
常见的使用Binding的代码:
C#
Binding binding = new Binding(); // Set source object binding.source = treeView; // Set source property binding.Path = new PropertyPath("SELEctedItem.Header"); // Attach to target property currentFolder.SetBinding(TextBlock.TextProperty,binding);
XAML:
<TextBlock x:Name=”currentFolder” DockPanel.Dock=”Top” Text=”{Binding ElementName=treeView, Path=SELEctedItem.Header}” BACkground=”AliceBlue” FontSize=”16”/>
(1)普通文本等绑定:
<TextBox x:Name="txtProductName" Grid.column="1" Margin="25,35,43,58" textwrapping="Wrap"
Text="{Binding ProductNamE}"/>
代码:
Product product = new Product()
{
ProductName="Audi",
ProductPrice=50000.0
};
txtProductName.DataContext = product;
(2)绑定的延生属性特点:
// 声明 public static IList<Graphic> features撤退路线;Grphic实际是一个表的行,有多个featrue.Attributes["NAME"]
tip.canvas.DataContext =MapClient.FeatureClass.features防汛人员[0];
<sdk:Label Content="{Binding Attributes[NAME]}" RenderTransformOrigin="0.128,0.381" Foreground="#FFFF2900" Margin="68,11,3,0"/>
(3) 控件元素绑定:绑定的实质是对类的操作。所以对于控件的属性,也可以绑定
//通过 ELEMENTNAME指定控件名
//通过Path指定控件的具体属性值
<esri:TimeSlider x:Name="@R_241_6674@Slider"
Loop="True" PlaySpeed="0:0:0.15"
MinimumValue="{Binding ElementName=Mymap,Path=Layers[MyHurricaneFeatureLayer].TimeExtent.Start,Mode=OneWay}"
MaximumValue="{Binding ElementName=Mymap,Path=Layers[MyHurricaneFeatureLayer].TimeExtent.End,Mode=OneWay}"
Value="2000/08/04 01:00:00 UTC,2000/08/07 01:00:00 UTC"
以上是大佬教程为你收集整理的silverlight绑定总结全部内容,希望文章能够帮你解决silverlight绑定总结所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。