【问题标题】:My progress bar inside a list is not updating in wpf application我的列表中的进度条没有在 wpf 应用程序中更新
【发布时间】:2017-08-20 00:09:31
【问题描述】:

我正在开发 WPF 应用程序,并且 ListBox 中的每个项目都有一个进度条,但是当我将它绑定到某个值时,它不会更新 UI。如果我设置一个特定的 int 值,比如 45,UI 就会更新。为什么它不绑定到值?

【问题讨论】:

标签: wpf progress-bar


【解决方案1】:

每个 ListBoxItem 都有自己的 DataContext(与视图不同)。如果 SawStatus 是视图模型的属性,则必须将绑定更改为类似

Value ="{Binding DataContext.SawStatus, RelativeSource={RelativeSource Mode=FindAncestor, AncestorType=ListBox }"

否则,您必须提供有关 ListBox 的 ItmesSource 的更多详细信息。

【讨论】:

  • 非常感谢。它的工作让我很生气。非常感谢你。
猜你喜欢
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 1970-01-01
  • 2017-08-01
相关资源
最近更新 更多