使用FindAncestor查找方式绑定且不需要使用datacontext
生活随笔
收集整理的這篇文章主要介紹了
使用FindAncestor查找方式绑定且不需要使用datacontext
小編覺得挺不錯的,現在分享給大家,幫大家做個參考.
使用FindAncestor查找方式綁定且不需要使用datacontext 原文:使用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為搜索第一層
posted on 2019-04-18 10:14 NET未來之路 閱讀(...) 評論(...) 編輯 收藏轉載于:https://www.cnblogs.com/lonelyxmas/p/10727972.html
總結
以上是生活随笔為你收集整理的使用FindAncestor查找方式绑定且不需要使用datacontext的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: jq01--概述
- 下一篇: 3.17-3.18 HDFS2.x中高级