zip's

while(true) { Write it down; Think about it; Refine it; Sleep(); }

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::
绑定到另一个控件的属性
<StackPanel>
<TextBox x:Name="theTextBox"/>
<TextBlock Text="{Binding Text, ElementName=theTextBox}"/>
</StackPanel>
上面这个例子,TextBlock的内容绑定了TextBox,当在TextBox里输入文本是,TextBlock也同时显示
 
---
绑定到 RelativeSource
<ListBox ItemsSource="{Binding MyDataSrc}" Width="200" Padding="0">
<ListBox.ItemTemplate>
<DataTemplate>
<Grid Width="{Binding Path=ActualWidth, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBoxItem}}">
<Button Content="{Binding}"/>
</Grid>
</DataTemplate>
</ListBox.ItemTemplate>
</ListBox>
{Binding Path=xxx, RelativeSource={RelativeSource Self}}
{Binding Path=xxx, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type typeXXX}}}
{Binding Path=xxx, RelativeSource={RelativeSource TemplatedParent}}
{TemplateBinding Path=xxx}
---
参考阅读:
 
---
To be continued ...
posted on 2010-08-18 14:58  zip's  阅读(500)  评论(0编辑  收藏  举报