原文:使用FindAncestor查找方式绑定且不需要使用datacontext
<UserControl x:Class="QuJiao.AnimationVideoPlayer"
xmlns:local="clr-namespace:QuJiao">
<TextBlock
Grid.Row="0" HorizontalAlignment="Center" VerticalAlignment="Stretch"
x:Name="TextBlock1"
Foreground="#999999"
FontFamily="微软雅黑"
FontSize="20"
Text="{Binding RelativeSource={RelativeSource Mode=FindAncestor,AncestorLevel=1,AncestorType=local:AnimationVideoPlayer},Path=VolumeText}"
/>
其中[local:AnimationVideoPlayer]即为在此类中查找绑定目标[VolumeText],AncestorLevel=1为搜索第一层