Xaml 地址位置类总结

1.资源地址

pack://application:,,,/Views/10FinanceRoutineFlowWnd/UCFlowLeaveAndOverApplicant.xaml

2.RelativeSource

指定当前元素和绑定源的位置(Path)关系 :
1.Self 自身的某些属性
Height="{Binding RelativeSource={RelativeSource Self},Path=Width}"
2.TemplatedParent 使用模板的对象
Color="{Binding Path=Background.Color,RelativeSource={RelativeSource TemplatedParent}}"
3.AncestorType 控件父级
<Grid>

<Label Background = {Binding Path=Background, RelativeSource={RelativeSource AncestorType={x:Type Grid}}}/>

</Grid>

这个例子中Label的背景色和Grid的背景色一样。

4.应用于所有控件的Style

//该样式应用于所有控件
<Style TargetType="{x:Type Control}">
</Style>

原文地址:https://www.cnblogs.com/mamaxiaoling/p/9805209.html