<Label Name="lblName" Height="28" HorizontalAlignment="Left" Margin="66,28,0,0" VerticalAlignment="Top" Width="93">Name</Label>
<Label Name="lblDate" Height="28" HorizontalAlignment="Left" Margin="66,62,0,0" VerticalAlignment="Top" Width="85">Date</Label>
<Label Name="lblContent" Margin="66,96,291,0" Height="28" VerticalAlignment="Top">content</Label>
<TextBox Height="23" Margin="165,28,157,0" Name="txtName" VerticalAlignment="Top" Text="NameString"/>
<TextBox Height="23" Margin="165,62,157,0" Name="txtDate" VerticalAlignment="Top" />
<TextBox Height="23" Margin="165,96,157,0" Name="txtContent" VerticalAlignment="Top" />
<TextBox Margin="74,130,157,0" Name="label6" Text="{Binding Mode=oneTime, ElementName=txtName ,Path=Text, UpdateSourceTrigger=propertyChanged }" Height="28" VerticalAlignment="Top"></TextBox>
<!-- 绑定 Mode属性指定oneTime 只绑定一次 oneway 单项绑定 twoway双向绑定 onwayToSource单项目标改变源被改变-->
<!-- ElementName 指定需要绑定的空间名称-->
<!-- Path 指定需要绑定控件的属性-->
<!-- UpdateSourceTrigger源空更新触发器 lostfocus 鼠标失去焦点是触发 propertyChanged属性改变时触发-->
<TextBox Height="28" Margin="74,0,157,71" Name="label4" VerticalAlignment="Bottom" Text="{Binding Mode=twoWay, ElementName=txtDate,Path=Text,UpdateSourceTrigger=lostfocus}"></TextBox>
<TextBox Height="28" Margin="74,0,157,37" Name="label5" VerticalAlignment="Bottom" Text="{Binding Mode=onewaytosource, ElementName=txtContent, Path=Text,UpdateSourceTrigger=propertyChanged}"></TextBox>
Binding的参数用法
最新推荐文章于 2024-10-23 10:18:48 发布