我正在Silverlight中构建一个wp7应用程序。我有一些异步加载的内容,并且指示加载的消息尚未完成。我希望一旦内容列表框不为空,加载消息就会消失。仅仅在XAML中可以做到这一点吗?类似于将Visibility
属性绑定到StoryListBox.ItemsSource.IsEmpty
?Silverlight:删除加载内容加载消息时没有代码?
StoryListBox
通过在数据可用后将其ItemsSource
设置为可观察集合来填充。
<TextBox x:Name="LoadingMessage" Text="Loading..." Grid.Row="0" />
<ProgressBar x:Name="LoadingProgress" IsIndeterminate="True" Style="{StaticResource PerformanceProgressBar}" />
<ListBox x:Name="StoryListBox" Grid.Row="0" />
更新:我尝试以下,但它不工作:
<StackPanel x:Name="Loading" Grid.Row="0" Visibility="{Binding StoryListBox.ItemsSource.IsEmpty, Converter={StaticResource visibilityConverter}}">
<TextBox Text="Loading..." />
<ProgressBar IsIndeterminate="True" Style="{StaticResource PerformanceProgressBar}" />
</StackPanel>
<ListBox x:Name="StoryListBox" Grid.Row="1" />
的Loading
堆叠面板永不崩溃。
如果您提供了有关ContentListBox如何绑定的更多详细信息,我会提供帮助吗?它的'ItemsSource'属性是在内容可用时分配的,还是只绑定到一个'ObservableCollection'或者一个ICollectionView'来获取项目? ContentListBox是xaml中的“StoryListBox”,你能整理这个不一致吗? – AnthonyWJones 2010-11-04 18:15:23