我正在寻找一种绑定数据模板的方法,该数据模板位于我的MainWindow访问的资源文件中,但只有在viewmodel中运行的任务完成后才会生效。
想法是加载大量数据,同时视图显示有一点进度区域...当进度完成时...那么数据应该被绑定...是依赖属性允许这个吗?
<DataTemplate x:Key="TabsTemplate">
<ItemsControl ItemsSource="{Binding}">
<ItemsControl.ItemsPanel>
<ItemsPanelTemplate>
<StackPanel Orientation="Horizontal" />
</ItemsPanelTemplate>
</ItemsControl.ItemsPanel>
<ItemsControl.ItemTemplate>
<DataTemplate>
<UserControls:TabButton Command="{Binding Path=Tab}" Content="{Binding Path=DisplayName}" Template="{Utilities:BindableResource {Binding Path=TemplateResource}}" />
</DataTemplate>
</ItemsControl.ItemTemplate>
</ItemsControl>
</DataTemplate>
答案 0 :(得分:0)
想出来......
Tabs.GetBindingExpression(ContentControl.ContentProperty).UpdateTarget();
完成进度后工作完美。