【问题标题】:WPF ViewBox blocks VisualTreeHelper searchWPF ViewBox 阻止 VisualTreeHelper 搜索
【发布时间】:2019-01-27 14:57:49
【问题描述】:

我已经为 MVVM-Light WPF 尝试过这种导航服务方法(查看优先) https://stackoverflow.com/a/28968560/5272185

我意识到如果 Frame 位于 ViewBox 内,则 VisualTreeHelper 搜索 Frame 元素不会找到 Frame。

对这种奇怪的行为有很好的解释吗? 是否有可能解决它?

【问题讨论】:

    标签: wpf mvvm mvvm-light viewbox visualtreehelper


    【解决方案1】:

    原来链接中的示例代码是问题所在。 如果您遇到此类问题,我建议您阅读 Josh Smith 的以下内容 Understanding the Visual Tree and Logical Tree in WPF

    他在Research Tool project 中提供的代码也成功地找到了位于 ViewBox 内的 ContentControl。我修改了他的代码以返回内容控件。问题解决了。

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2018-03-17
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多