1.将元素绑定到一起
忘记做笔记
2.绑定到非元素对象
<Window.Resources>
<FontFamily x:Key="CustomFont">Calibri</FontFamily>
</Window.Resources>
<Grid>
<StackPanel Name="StackPanel1">
<!--获取窗体字体样式-->
<TextBlock Height="auto" Text="{Binding Source={x:Static SystemFonts.IconFontFamily},Path=Source}"></TextBlock>
<!--获取自定义资源-->
<TextBlock Height="auto" Text="{Binding Source={StaticResource CustomFont},Path=Source}"></TextBlock>
<!--获取指定父级元素的属性-->
<TextBlock Height="auto" Text="{Binding Path=Name,RelativeSource={RelativeSource Mode=FindAncestor,AncestorType={x:Type StackPanel},AncestorLevel=1}}"></TextBlock>
</StackPanel>
</Grid>
原文:https://www.cnblogs.com/wskxy/p/11355458.html