【问题标题】:WPF Binding: Waiting for ItemsSourceWPF 绑定:等待 ItemsSource
【发布时间】:2011-10-26 09:18:23
【问题描述】:

我对以下绑定有疑问:

<telerik:RadComboBox ItemsSource="{Binding Source={StaticResource TemplateDataSource}, Path=Templates}"
                     SelectedValue="{Binding Template}"
                     SelectedValuePath="Id"
                     DisplayMemberPath="Title"
                     Margin="0">
</telerik:RadComboBox>

我的所有数据都是通过 WCF 数据服务异步加载的。

我有时会收到以下错误(我可以追溯到上面的绑定)

Specified argument was out of the range of valid values.
Parameter name: index

现在我想这与提供在 ItemsSource 之前加载的 SelectedValue(模板)的实体有关。这可能吗?是否有解决此问题的方法,例如等待 ItemsSource 加载?

提前感谢您的帮助!

【问题讨论】:

    标签: wpf data-binding mvvm binding


    【解决方案1】:

    尝试在SelectedValue="{Binding Template}" 上编写虚拟转换器 然后您可以调试此转换器以找出错误的真正原因。

    【讨论】:

    • PresentationTraceSources.TraceLevel="High" 也可能有所帮助。我会声明 mode = .
    猜你喜欢
    • 2015-04-07
    • 1970-01-01
    • 1970-01-01
    • 2011-12-17
    • 2011-01-14
    • 2011-03-16
    • 2011-07-10
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多